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