summaryrefslogtreecommitdiff
path: root/resolv/res_init.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2014-12-17 18:09:11 +0000
committerJoseph Myers <joseph@codesourcery.com>2014-12-17 18:09:11 +0000
commit8ac5a76a99e51a91eac9cecbe941fc05ddf11e03 (patch)
tree76a65f8b81308ff6f6c84f5b6b3628673b2178cf /resolv/res_init.c
parent66ce3cb12f74d3dbd4018ce6498a36348acf7e83 (diff)
downloadglibc-8ac5a76a99e51a91eac9cecbe941fc05ddf11e03.tar.gz
Fix resolver inet_* namespace (bug 17722).
Parts of the resolver brought in by pthreads (at least) use inet_* functions that aren't in the 1995/6 edition of POSIX that introduced pthreads (or in one case, use __inet_aton which is then defined in the same file as non-weak inet_addr). This patch fixes this by making the affected functions into weak alias for __inet_* and using those names in the problematic resolver code. Tested for x86_64 (testsuite, and that disassembly of installed shared libraries is unchanged by the patch). [BZ #17722] * inet/inet_mkadr.c (inet_makeaddr): Rename to __inet_makeaddr and define as weak alias of __inet_makeaddr. * resolv/inet_addr.c (inet_addr): Rename to __inet_addr and define as weak alias of __inet_addr. * resolv/inet_pton.c (inet_pton): Rename to __inet_pton and define as weak alias of __inet_pton. Use libc_hidden_weak. * include/arpa/inet.h (__inet_pton): Declare. Use libc_hidden_proto. (inet_makeaddr): Don't use libc_hidden_proto. (__inet_makeaddr): Declare. Use libc_hidden_proto. * resolv/res_init.c (__res_vinit): Use __inet_pton instead of inet_pton. Use __inet_makeaddr instead of inet_makeaddr. * conform/Makefile (test-xfail-POSIX/pthread.h/linknamespace): Remove variable. (test-xfail-POSIX/sched.h/linknamespace): Likewise. (test-xfail-POSIX/time.h/linknamespace): Likewise.
Diffstat (limited to 'resolv/res_init.c')
-rw-r--r--resolv/res_init.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/resolv/res_init.c b/resolv/res_init.c
index 6eddcdd0b2..d492a08aee 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -324,7 +324,7 @@ __res_vinit(res_state statp, int preinit) {
if ((el = strchr(cp, SCOPE_DELIMITER)) != NULL)
*el = '\0';
if ((*cp != '\0') &&
- (inet_pton(AF_INET6, cp, &a6) > 0)) {
+ (__inet_pton(AF_INET6, cp, &a6) > 0)) {
struct sockaddr_in6 *sa6;
sa6 = malloc(sizeof(*sa6));
@@ -428,7 +428,7 @@ __res_vinit(res_state statp, int preinit) {
(void) fclose(fp);
}
if (__builtin_expect(statp->nscount == 0, 0)) {
- statp->nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1);
+ statp->nsaddr.sin_addr = __inet_makeaddr(IN_LOOPBACKNET, 1);
statp->nsaddr.sin_family = AF_INET;
statp->nsaddr.sin_port = htons(NAMESERVER_PORT);
statp->nscount = 1;