summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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