summaryrefslogtreecommitdiffstats
path: root/lib/libutil
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2003-01-27 03:14:04 +0000
committerache <ache@FreeBSD.org>2003-01-27 03:14:04 +0000
commit779e19d00079797682b0f2839f0fcfc0506e4414 (patch)
treec9161d7d9c624660bfff148e67b1c41802a1479c /lib/libutil
parented35d2280e5796e2f60582327fa8d9bfd5eb90e4 (diff)
downloadFreeBSD-src-779e19d00079797682b0f2839f0fcfc0506e4414.zip
FreeBSD-src-779e19d00079797682b0f2839f0fcfc0506e4414.tar.gz
Handle read errors
Diffstat (limited to 'lib/libutil')
-rw-r--r--lib/libutil/property.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/libutil/property.c b/lib/libutil/property.c
index 91270f8..0a31879 100644
--- a/lib/libutil/property.c
+++ b/lib/libutil/property.c
@@ -90,11 +90,14 @@ properties_read(int fd)
}
switch(state) {
case FILL:
- if ((max = read(fd, buf, sizeof buf)) <= 0) {
+ if ((max = read(fd, buf, sizeof buf)) < 0) {
+ properties_free(head);
+ return (NULL);
+ }
+ if (max == 0) {
state = STOP;
break;
- }
- else {
+ } else {
state = LOOK;
ch = buf[0];
bp = 1;
OpenPOWER on IntegriCloud