From e3cdd30a7a74ebe571e2a52dcce82599f085669d Mon Sep 17 00:00:00 2001 From: Waldemar Kornewald Date: Mon, 13 Oct 2003 14:42:18 +0000 Subject: [PATCH] Quick and dirty fix of the DNS resolver bug. Now "ping localhost" works again! :)) The problem was that netdb.h defined a macro that always replaced h_errno with a function call so that libnet.so failed when res_query (and all other functions using h_errno, but this is where the bug occured for me) tried to assign a new value to h_errno which of course failed because it was actually assigned to the return value of _h_errnop(). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5010 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/network/libnet/compat.c | 2 ++ src/kits/network/libnet/getaddrinfo.c | 3 +++ src/kits/network/libnet/getnameinfo.c | 3 +++ src/kits/network/libnet/getnetnamadr.c | 2 ++ src/kits/network/libnet/res_debug.c | 3 +++ src/kits/network/libnet/res_mkquery.c | 3 +++ src/kits/network/libnet/res_query.c | 4 +++- 7 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/kits/network/libnet/compat.c b/src/kits/network/libnet/compat.c index 3040fe81fe..6a51d857bb 100644 --- a/src/kits/network/libnet/compat.c +++ b/src/kits/network/libnet/compat.c @@ -13,6 +13,8 @@ #include +#undef h_errno + // was defined by netdb.h static int32 h_errno_tls; /* These should probably be moved to a seperate file as they diff --git a/src/kits/network/libnet/getaddrinfo.c b/src/kits/network/libnet/getaddrinfo.c index 103471b93d..1e01ba4a26 100644 --- a/src/kits/network/libnet/getaddrinfo.c +++ b/src/kits/network/libnet/getaddrinfo.c @@ -96,6 +96,9 @@ */ #include +#undef h_errno + // was defined by netdb.h + #ifdef YP #include #include diff --git a/src/kits/network/libnet/getnameinfo.c b/src/kits/network/libnet/getnameinfo.c index a082b39fb1..52abcb1bd9 100644 --- a/src/kits/network/libnet/getnameinfo.c +++ b/src/kits/network/libnet/getnameinfo.c @@ -52,6 +52,9 @@ #include #include +#undef h_errno + // was defined by netdb.h + static const struct afd { int a_af; int a_addrlen; diff --git a/src/kits/network/libnet/getnetnamadr.c b/src/kits/network/libnet/getnetnamadr.c index 1231ed7fbd..e53c020d4a 100644 --- a/src/kits/network/libnet/getnetnamadr.c +++ b/src/kits/network/libnet/getnetnamadr.c @@ -83,6 +83,8 @@ #include #include +#undef h_errno + // was defined by netdb.h extern int h_errno; struct netent *_getnetbyaddr (in_addr_t net, int type); diff --git a/src/kits/network/libnet/res_debug.c b/src/kits/network/libnet/res_debug.c index 089bf90d2c..dc16b3b671 100644 --- a/src/kits/network/libnet/res_debug.c +++ b/src/kits/network/libnet/res_debug.c @@ -91,6 +91,9 @@ #include #include +#undef h_errno + // was defined by netdb.h + extern const char *_res_opcodes[]; extern const char *_res_resultcodes[]; diff --git a/src/kits/network/libnet/res_mkquery.c b/src/kits/network/libnet/res_mkquery.c index cc573842c7..eca7749a45 100644 --- a/src/kits/network/libnet/res_mkquery.c +++ b/src/kits/network/libnet/res_mkquery.c @@ -64,6 +64,9 @@ #include #include +#undef h_errno + // was defined by netdb.h + /* * Form all types of queries. * Returns the size of the result or -1. diff --git a/src/kits/network/libnet/res_query.c b/src/kits/network/libnet/res_query.c index 3b45b8e02d..b6db3acfa4 100644 --- a/src/kits/network/libnet/res_query.c +++ b/src/kits/network/libnet/res_query.c @@ -75,7 +75,9 @@ #endif const char *hostalias (const char *); -int h_errno; +#undef h_errno + // was defined by netdb.h +int h_errno = 0; extern int res_opt (int, u_char *, int, int); /*