summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/rib.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/lib/rib.c b/src/lib/rib.c
index 31ab372f..e0456b6f 100644
--- a/src/lib/rib.c
+++ b/src/lib/rib.c
@@ -690,7 +690,8 @@ bool rib_has(const char * path)
{
struct rnode * node;
- assert(path);
+ if (path == NULL)
+ return -EINVAL;
pthread_rwlock_rdlock(&rib.lock);
@@ -710,8 +711,8 @@ ssize_t rib_children(const char * path,
ssize_t i = 0;
- assert(path);
- assert(children);
+ if (path == NULL)
+ return -EINVAL;
pthread_rwlock_rdlock(&rib.lock);
@@ -721,6 +722,12 @@ ssize_t rib_children(const char * path,
return -EPERM;
}
+ if (children == NULL) {
+ pthread_rwlock_unlock(&rib.lock);
+ assert((ssize_t) node->chlen >= 0);
+ return (ssize_t) node->chlen;
+ }
+
if (node->chlen == 0) {
pthread_rwlock_unlock(&rib.lock);
*children = NULL;