getnameinfo() returns an error code which can be passed to
gai_strerror() for human consumption.  So use that instead of
strerror(errno) unless the code is EAI_SYSTEM.

Signed-off-by: Julien Cristau <[email protected]>
Cc: Philipp Kern <[email protected]>
---
 netcfg-common.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/netcfg-common.c b/netcfg-common.c
index 0bc4e43..4134250 100644
--- a/netcfg-common.c
+++ b/netcfg-common.c
@@ -1245,7 +1245,7 @@ int get_hostname_from_dns (const struct netcfg_interface 
*interface, char *hostn
         }
 
         if (err) {
-            di_debug("getnameinfo() returned %i: errno %i (%s)", err, errno, 
strerror(errno));
+            di_debug("getnameinfo() returned %i (%s)", err, err == EAI_SYSTEM 
? strerror(errno) : gai_strerror(err));
         }
 
         if (err == 0) {
@@ -1291,7 +1291,7 @@ int get_hostname_from_dns (const struct netcfg_interface 
*interface, char *hostn
                                     : sizeof(struct sockaddr_in6),
                               hostname, max_hostname_len, NULL, 0, 
NI_NAMEREQD);
             if (err) {
-                di_debug("getnameinfo() returned %i: errno %i (%s)", err, 
errno, strerror(errno));
+                di_debug("getnameinfo() returned %i (%s)", err, err == 
EAI_SYSTEM ? strerror(errno) : gai_strerror(err));
             }
                               
             if (err == 0) {
-- 
1.7.10.4


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: 
http://lists.debian.org/[email protected]

Reply via email to