nwrap: better error propagation in nwrap_add_hname_alias
authorMichael Adam <obnox@samba.org>
Wed, 11 Nov 2015 11:27:33 +0000 (12:27 +0100)
committerMichael Adam <obnox@samba.org>
Mon, 11 Jan 2016 11:25:30 +0000 (12:25 +0100)
use return codes from the called function.
Remove asserts becaus the cases are caught
by the called functions.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
lib/nss_wrapper/nss_wrapper.c

index 064d3d7872ad8dcc4e52cd8c8fb279e744362f62..343bff75cf7ee89c802eb8bca01699f4c87bd00c 100644 (file)
@@ -2661,9 +2661,7 @@ static bool nwrap_add_hname_alias(char *const h_name_a,
 {
        ENTRY e;
        ENTRY *p;
-
-       assert(ed != NULL);
-       assert(h_name_a != NULL);
+       bool ok;
 
        e.key = h_name_a;
        e.data = NULL;
@@ -2671,16 +2669,15 @@ static bool nwrap_add_hname_alias(char *const h_name_a,
        p = hsearch(e, FIND);
        if (p == NULL) {
                NWRAP_LOG(NWRAP_LOG_DEBUG, "Name %s not found. Adding...", h_name_a);
-               nwrap_add_hname_add_new(h_name_a, ed);
+               ok = nwrap_add_hname_add_new(h_name_a, ed);
        } else {
                struct nwrap_entlist *el = (struct nwrap_entlist *)p->data;
 
-               assert(p->data != NULL);
                NWRAP_LOG(NWRAP_LOG_DEBUG, "Name %s found. Add record to list.", h_name_a);
-               nwrap_add_hname_add_to_existing(ed, el);
+               ok = nwrap_add_hname_add_to_existing(ed, el);
        }
 
-       return true;
+       return ok;
 }
 
 static bool nwrap_add_hname(struct nwrap_entdata *const ed)