]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
support_format_hostent: Add more error information for NETDB_INTERNAL
authorFlorian Weimer <fweimer@redhat.com>
Thu, 5 Oct 2017 10:20:19 +0000 (12:20 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Thu, 5 Oct 2017 10:20:19 +0000 (12:20 +0200)
ChangeLog
support/support_format_hostent.c

index bb09add53d9f58b211172e45f5074f77cb2f6f87..9cc0df5aafab015d5edee37797535861277e762a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-10-05  Florian Weimer  <fweimer@redhat.com>
+
+       * support/support_format_hostent.c (support_format_hostent): Add
+       more error information for NETDB_INTERNAL.
+
 2017-10-04  H.J. Lu  <hongjiu.lu@intel.com>
 
        * config.h.in (NO_HIDDEN_EXTERN_FUNC_IN_PIE): New.
index 5b5f26082efa69330321c8fe55a77c60d0e95547..88c85ec1f1f31e450528f5644d49cdfa43c9b027 100644 (file)
@@ -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;