diff options
-rw-r--r-- | include/netdb.h | 6 | ||||
-rw-r--r-- | src/network/h_errno.c | 8 | ||||
-rw-r--r-- | src/network/res_query.c | 1 |
3 files changed, 14 insertions, 1 deletions
diff --git a/include/netdb.h b/include/netdb.h index a480d82f..33b7a0ab 100644 --- a/include/netdb.h +++ b/include/netdb.h @@ -128,7 +128,11 @@ struct hostent *gethostbyaddr (const void *, socklen_t, int); int gethostbyaddr_r(const void *, socklen_t, int, struct hostent *, char *, size_t, struct hostent **, int *); int getservbyport_r(int, const char *, struct servent *, char *, size_t, struct servent **); int getservbyname_r(const char *, const char *, struct servent *, char *, size_t, struct servent **); -extern int h_errno; +#ifdef __GNUC__ +__attribute__((const)) +#endif +int *__h_errno_location(void); +#define h_errno (*__h_errno_location()) #define EAI_NODATA -5 #define EAI_ADDRFAMILY -9 #define EAI_INPROGRESS -100 diff --git a/src/network/h_errno.c b/src/network/h_errno.c index 73ead046..5560234c 100644 --- a/src/network/h_errno.c +++ b/src/network/h_errno.c @@ -1 +1,9 @@ +#include <netdb.h> + +#undef h_errno; int h_errno; + +int *__h_errno_location(void) +{ + return &h_errno; +} diff --git a/src/network/res_query.c b/src/network/res_query.c index 42009992..c3ad1090 100644 --- a/src/network/res_query.c +++ b/src/network/res_query.c @@ -1,3 +1,4 @@ +#define _GNU_SOURCE #include <netdb.h> #include "__dns.h" #include "libc.h" |