fa3bfd
Partial backport of this upstream commit:
fa3bfd
fa3bfd
commit 9acacaa02f3b75fddc07a56f3d848df45281a5de
fa3bfd
Author: Joseph Myers <joseph@codesourcery.com>
fa3bfd
Date:   Fri Jun 12 10:10:18 2015 +0000
fa3bfd
fa3bfd
    Fix h_errno namespace (bug 18520).
fa3bfd
fa3bfd
The linknamespace test changes in conform/Makefile are not included here
fa3bfd
because glibc 2.17 did not have these tests.
fa3bfd
fa3bfd
diff --git a/include/netdb.h b/include/netdb.h
fa3bfd
index b6d7b90bbf8abd2e..6a6dca9ef57aaa37 100644
fa3bfd
--- a/include/netdb.h
fa3bfd
+++ b/include/netdb.h
fa3bfd
@@ -8,7 +8,7 @@
fa3bfd
 #  if IS_IN (libc)
fa3bfd
 #   define h_errno __libc_h_errno
fa3bfd
 #  else
fa3bfd
-#   define h_errno h_errno	/* For #ifndef h_errno tests.  */
fa3bfd
+#   define h_errno __h_errno
fa3bfd
 #  endif
fa3bfd
 extern __thread int h_errno attribute_tls_model_ie;
fa3bfd
 # endif /* IS_IN_LIB */
fa3bfd
diff --git a/inet/herrno.c b/inet/herrno.c
fa3bfd
index 1802d0e00563839a..0cd84445190728b3 100644
fa3bfd
--- a/inet/herrno.c
fa3bfd
+++ b/inet/herrno.c
fa3bfd
@@ -24,7 +24,7 @@
fa3bfd
 /* We need to have the error status variable of the resolver
fa3bfd
    accessible in the libc.  */
fa3bfd
 
fa3bfd
-__thread int h_errno;
fa3bfd
-extern __thread int __libc_h_errno __attribute__ ((alias ("h_errno")))
fa3bfd
+__thread int __h_errno;
fa3bfd
+extern __thread int __libc_h_errno __attribute__ ((alias ("__h_errno")))
fa3bfd
   attribute_hidden;
fa3bfd
 #define h_errno __libc_h_errno
fa3bfd
diff --git a/nptl/herrno.c b/nptl/herrno.c
fa3bfd
index c0488e4f6754873f..5056e3df88211123 100644
fa3bfd
--- a/nptl/herrno.c
fa3bfd
+++ b/nptl/herrno.c
fa3bfd
@@ -23,12 +23,12 @@
fa3bfd
 
fa3bfd
 /* We need to have the error status variable of the resolver
fa3bfd
    accessible in the libc.  */
fa3bfd
-extern __thread int h_errno;
fa3bfd
+extern __thread int __h_errno;
fa3bfd
 
fa3bfd
 
fa3bfd
 /* When threaded, h_errno may be a per-thread variable.  */
fa3bfd
 int *
fa3bfd
 __h_errno_location (void)
fa3bfd
 {
fa3bfd
-  return &h_errno;
fa3bfd
+  return &__h_errno;
fa3bfd
 }
fa3bfd
diff --git a/resolv/Versions b/resolv/Versions
fa3bfd
index 93faf1e2f5faac79..152ef3f68f9a8b48 100644
fa3bfd
--- a/resolv/Versions
fa3bfd
+++ b/resolv/Versions
fa3bfd
@@ -26,7 +26,7 @@ libc {
fa3bfd
   GLIBC_PRIVATE {
fa3bfd
     __gai_sigqueue;
fa3bfd
 
fa3bfd
-    h_errno; __resp;
fa3bfd
+    __h_errno; __resp;
fa3bfd
 
fa3bfd
     __res_maybe_init; __res_iclose;
fa3bfd
   }