nwrap: improve code readability in nwrap_getaddrinfo()
authorMichael Adam <obnox@samba.org>
Fri, 6 Nov 2015 10:31:09 +0000 (11:31 +0100)
committerMichael Adam <obnox@samba.org>
Mon, 11 Jan 2016 11:25:29 +0000 (12:25 +0100)
Untangle a (a ? b : c) statement and add an explanatory
comment, since the intention is not immediately obvious.

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

index 63d5325efbfcbd7102a9a88efee9e1a9f1686d4f..3dce079eca6761675bc2151785deaf1bfba0cb05 100644 (file)
@@ -5135,7 +5135,15 @@ valid_port:
        }
 
        if (rc < 0) {
-               return ret == 0 ? 0 : eai;
+               if (ret == 0) {
+                       /*
+                        * nwrap_files_getaddrinfo failed, but libc was
+                        * successful -- use the result from libc.
+                        */
+                       return 0;
+               }
+
+               return eai;
        }
 
        if (ret == 0) {