From: Michael Adam Date: Wed, 11 Nov 2015 11:27:33 +0000 (+0100) Subject: nwrap: better error propagation in nwrap_add_hname_alias X-Git-Tag: samba-4.4.0rc1~226 X-Git-Url: http://git.samba.org/samba.git/?p=sfrench%2Fsamba-autobuild%2F.git;a=commitdiff_plain;h=ddd0ca82bb3c74de3996a8ddbe85b6d29e14f552 nwrap: better error propagation in nwrap_add_hname_alias use return codes from the called function. Remove asserts becaus the cases are caught by the called functions. Signed-off-by: Michael Adam Reviewed-by: Andreas Schneider --- diff --git a/lib/nss_wrapper/nss_wrapper.c b/lib/nss_wrapper/nss_wrapper.c index 064d3d7872a..343bff75cf7 100644 --- a/lib/nss_wrapper/nss_wrapper.c +++ b/lib/nss_wrapper/nss_wrapper.c @@ -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)