From 7f994279e900954f2b220a02fa01f2042eef74b1 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 2 Dec 2014 23:11:09 +0000 Subject: Fix getifaddrs, freeifaddrs namespace (bug 17668). Various objects in glibc bring in ifaddrs.o (via references to __netlink_*) and thereby getifaddrs and freeifaddrs, which are not part of any standard supported by glibc. These should be weak aliases of __getifaddrs and __freeifaddrs; this patch makes them so. (The path by which these functions are brought in is Linux-specific, but it seems less confusing to make all versions of these functions weak aliases rather than only the Linux-specific versions that definitely need it.) Tested for x86_64 (testsuite, and that disassembly of installed shared libraries is unchanged by this patch). [BZ #17668] * inet/ifaddrs.c (getifaddrs): Rename to __getifaddrs and define as weak alias of __getifaddrs. Use libc_hidden_weak. (freeifaddrs): Rename to __freeifaddrs and define as weak alias of __freeifaddrs. Use libc_hidden_weak. * sysdeps/gnu/ifaddrs.c (getifaddrs): Rename to __getifaddrs and define as weak alias of __getifaddrs. Use libc_hidden_weak. (freeifaddrs): Rename to __freeifaddrs and define as weak alias of __freeifaddrs. Use libc_hidden_weak. * sysdeps/unix/sysv/linux/ifaddrs.c (getifaddrs): Rename to __getifaddrs and define as weak alias of __getifaddrs. Use libc_hidden_weak. (freeifaddrs): Rename to __freeifaddrs and define as weak alias of __freeifaddrs. Use libc_hidden_weak. * conform/Makefile (test-xfail-XOPEN2K/net/if.h/linknamespace): Remove variable. (test-xfail-POSIX2008/net/if.h/linknamespace): Likewise. (test-xfail-XOPEN2K8/net/if.h/linknamespace): Likewise. --- inet/ifaddrs.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'inet') diff --git a/inet/ifaddrs.c b/inet/ifaddrs.c index 8071600949..bc273c6364 100644 --- a/inet/ifaddrs.c +++ b/inet/ifaddrs.c @@ -24,16 +24,17 @@ network interface on the host machine. If successful, store the list in *IFAP and return 0. On errors, return -1 and set `errno'. */ int -getifaddrs (struct ifaddrs **ifap) +__getifaddrs (struct ifaddrs **ifap) { __set_errno (ENOSYS); return -1; } -libc_hidden_def (getifaddrs) +weak_alias (__getifaddrs, getifaddrs) +libc_hidden_weak (getifaddrs) stub_warning (getifaddrs) void -freeifaddrs (struct ifaddrs *ifa) +__freeifaddrs (struct ifaddrs *ifa) { if (ifa == NULL) return; /* a la free, why not? */ @@ -41,5 +42,6 @@ freeifaddrs (struct ifaddrs *ifa) /* Can't be called properly if getifaddrs never succeeded. */ abort (); } -libc_hidden_def (freeifaddrs) +weak_alias (__freeifaddrs, freeifaddrs) +libc_hidden_weak (freeifaddrs) stub_warning (freeifaddrs) -- cgit v1.2.3