about summary refs log tree commit diff
path: root/support
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2017-10-05 12:20:19 +0200
committerFlorian Weimer <fweimer@redhat.com>2017-10-05 12:20:19 +0200
commit84d0e6f05212cabe786cdf00bf3ba5d166d077c0 (patch)
tree48abc8363eafe07aa39278190817b4a166ea18f1 /support
parentee417882e07277b2a36e7e61e6ef7edd96415b3f (diff)
downloadglibc-84d0e6f05212cabe786cdf00bf3ba5d166d077c0.tar.gz
glibc-84d0e6f05212cabe786cdf00bf3ba5d166d077c0.tar.xz
glibc-84d0e6f05212cabe786cdf00bf3ba5d166d077c0.zip
support_format_hostent: Add more error information for NETDB_INTERNAL
Diffstat (limited to 'support')
-rw-r--r--support/support_format_hostent.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/support/support_format_hostent.c b/support/support_format_hostent.c
index 5b5f26082e..88c85ec1f1 100644
--- a/support/support_format_hostent.c
+++ b/support/support_format_hostent.c
@@ -19,6 +19,7 @@
 #include <support/format_nss.h>
 
 #include <arpa/inet.h>
+#include <errno.h>
 #include <stdio.h>
 #include <support/support.h>
 #include <support/xmemstream.h>
@@ -41,10 +42,15 @@ support_format_hostent (struct hostent *h)
 {
   if (h == NULL)
     {
-      char *value = support_format_herrno (h_errno);
-      char *result = xasprintf ("error: %s\n", value);
-      free (value);
-      return result;
+      if (h_errno == NETDB_INTERNAL)
+        return xasprintf ("error: NETDB_INTERNAL (errno %d, %m)\n", errno);
+      else
+        {
+          char *value = support_format_herrno (h_errno);
+          char *result = xasprintf ("error: %s\n", value);
+          free (value);
+          return result;
+        }
     }
 
   struct xmemstream mem;