Backport of this upstream commit:
commit 7f9d00341057eb80b43fa83956b8d7798b4dabea
Author: Roland McGrath <roland@hack.frob.com>
Date: Tue Aug 27 11:09:33 2013 -0700
Clean up h_errno declaration to use __thread unconditionally.
Adjusted for the IS_IN changes, which were applied upstream after this
commit (and downstream before its backport).
diff --git a/include/netdb.h b/include/netdb.h
index 3b24747fd5df6562..b6d7b90bbf8abd2e 100644
--- a/include/netdb.h
+++ b/include/netdb.h
@@ -5,17 +5,12 @@
/* Macros for accessing h_errno from inside libc. */
# if IS_IN_LIB
# undef h_errno
-# ifdef _LIBC_REENTRANT
-# include <tls.h>
-# if IS_IN (libc)
-# define h_errno __libc_h_errno
-# else
-# define h_errno h_errno /* For #ifndef h_errno tests. */
-# endif
-extern __thread int h_errno attribute_tls_model_ie;
+# if IS_IN (libc)
+# define h_errno __libc_h_errno
# else
-extern int h_errno;
-# endif /* _LIBC_REENTRANT */
+# define h_errno h_errno /* For #ifndef h_errno tests. */
+# endif
+extern __thread int h_errno attribute_tls_model_ie;
# endif /* IS_IN_LIB */
# define __set_h_errno(x) (h_errno = (x))