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