summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libutil/property.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/libutil/property.c b/lib/libutil/property.c
index 0a31879..34e6ee3 100644
--- a/lib/libutil/property.c
+++ b/lib/libutil/property.c
@@ -216,20 +216,23 @@ properties_read(int fd)
break;
}
}
+ if (head == NULL && (head = property_alloc(NULL, NULL)) == NULL)
+ return (NULL);
+
return (head);
}
char *
property_find(properties list, const char *name)
{
- if (!list || !name || !name[0])
- return NULL;
- while (list) {
- if (!strcmp(list->name, name))
- return list->value;
+ if (list == NULL || name == NULL || !name[0])
+ return (NULL);
+ while (list != NULL) {
+ if (list->name != NULL && strcmp(list->name, name) == 0)
+ return (list->value);
list = list->next;
}
- return NULL;
+ return (NULL);
}
void
OpenPOWER on IntegriCloud