[PATCH 07/27] libnetworking: Add *__h_errno() instead of h_errno.

Christian Mauderer christian.mauderer at embedded-brains.de
Fri Jun 24 09:38:26 UTC 2016


From: Christian Mauderer <Christian.Mauderer at embedded-brains.de>

---
 cpukit/libnetworking/libc/gethostbydns.c | 1 -
 cpukit/libnetworking/libc/getnetbydns.c  | 2 --
 cpukit/libnetworking/libc/herror.c       | 8 +++++++-
 cpukit/libnetworking/resolv.h            | 9 ---------
 4 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/cpukit/libnetworking/libc/gethostbydns.c b/cpukit/libnetworking/libc/gethostbydns.c
index ba7291f..7300ef4 100644
--- a/cpukit/libnetworking/libc/gethostbydns.c
+++ b/cpukit/libnetworking/libc/gethostbydns.c
@@ -118,7 +118,6 @@ typedef union {
     char ac;
 } align;
 
-extern int h_errno;
 int _dns_ttl_;
 
 #ifdef DEBUG
diff --git a/cpukit/libnetworking/libc/getnetbydns.c b/cpukit/libnetworking/libc/getnetbydns.c
index a92fba6..adbd0c9 100644
--- a/cpukit/libnetworking/libc/getnetbydns.c
+++ b/cpukit/libnetworking/libc/getnetbydns.c
@@ -80,8 +80,6 @@
 
 #include "res_config.h"
 
-extern int h_errno;
-
 #define BYADDR 0
 #define BYNAME 1
 #define	MAXALIASES	35
diff --git a/cpukit/libnetworking/libc/herror.c b/cpukit/libnetworking/libc/herror.c
index e7d6ba4..bb1112f 100644
--- a/cpukit/libnetworking/libc/herror.c
+++ b/cpukit/libnetworking/libc/herror.c
@@ -67,7 +67,13 @@ const char *h_errlist[] = {
 };
 int	h_nerr = { sizeof h_errlist / sizeof h_errlist[0] };
 
-int	h_errno;
+int *
+__h_errno(void)
+{
+	static int the_h_errno;
+
+	return &the_h_errno;
+}
 
 #define HERROR_USE_WRITEV
 
diff --git a/cpukit/libnetworking/resolv.h b/cpukit/libnetworking/resolv.h
index 6c87a00..06d3a55 100644
--- a/cpukit/libnetworking/resolv.h
+++ b/cpukit/libnetworking/resolv.h
@@ -69,15 +69,6 @@
 #define	__RES	19960801
 
 /*%
- * This used to be defined in res_query.c, now it's in herror.c.  It was
- * never extern'd by any *.h file before it was placed here.  herror.c is
- * part of libresolv.a even though it might make more sense in libnetdb.a
- * or even libnet.a.
- */
-
-extern int h_errno;
-
-/*%
  * Resolver configuration file.
  * Normally not present, but may contain the address of the
  * initial name server(s) to query and the domain search list.
-- 
1.8.4.5




More information about the devel mailing list