summary refs log tree commit diff
path: root/dirent
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-02-19 17:18:51 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-02-19 17:18:51 +0000
commit40176158f1bfcf4fd1621169221c1aa8f0c3c300 (patch)
tree52a8351f99e40724de12016b07625877253b6c47 /dirent
parent4629c866ad79167d60ca9bf263d871eabb59d3d9 (diff)
downloadglibc-40176158f1bfcf4fd1621169221c1aa8f0c3c300.tar.gz
glibc-40176158f1bfcf4fd1621169221c1aa8f0c3c300.tar.xz
glibc-40176158f1bfcf4fd1621169221c1aa8f0c3c300.zip
Fix scandir scandirat namespace (bug 17999).
The POSIX function scandir calls scandirat, which is not a POSIX
function.  This patch fixes this by making it use __scandirat and
making scandirat a weak alias.  There are no changes for scandir64 /
scandirat64 because those are both _GNU_SOURCE-only functions so no
namespace issue arises for them.

Tested for x86_64 that the disassembly of installed shared libraries
is unchanged by this patch.

	[BZ #17999]
	* dirent/scandir.c [!SCANDIR] (SCANDIRAT): Define to __scandirat
	instead of scandirat.
	* dirent/scandirat.c [!SCANDIRAT] (SCANDIRAT): Likewise.
	[!SCANDIRAT] (SCANDIRAT_WEAK_ALIAS): Define.
	[SCANDIRAT_WEAK_ALIAS] (scandirat): Define as weak alias of
	__scandirat.
	* include/dirent.h (scandirat): Do not use libc_hidden_proto.
	(__scandirat): Declare.  Use libc_hidden_proto.
	* conform/Makefile (test-xfail-POSIX2008/dirent.h/linknamespace):
	Remove variable.
	(test-xfail-XOPEN2K8/dirent.h/linknamespace): Likewise.
Diffstat (limited to 'dirent')
-rw-r--r--dirent/scandir.c2
-rw-r--r--dirent/scandirat.c6
2 files changed, 6 insertions, 2 deletions
diff --git a/dirent/scandir.c b/dirent/scandir.c
index 1039b9b968..99c968181c 100644
--- a/dirent/scandir.c
+++ b/dirent/scandir.c
@@ -28,7 +28,7 @@
 
 #ifndef SCANDIR
 # define SCANDIR scandir
-# define SCANDIRAT scandirat
+# define SCANDIRAT __scandirat
 # define DIRENT_TYPE struct dirent
 #endif
 
diff --git a/dirent/scandirat.c b/dirent/scandirat.c
index 1147cee43f..004b1527f3 100644
--- a/dirent/scandirat.c
+++ b/dirent/scandirat.c
@@ -30,9 +30,10 @@
 #include <bits/libc-lock.h>
 
 #ifndef SCANDIRAT
-# define SCANDIRAT scandirat
+# define SCANDIRAT __scandirat
 # define READDIR __readdir
 # define DIRENT_TYPE struct dirent
+# define SCANDIRAT_WEAK_ALIAS
 #endif
 
 #ifndef SKIP_SCANDIR_CANCEL
@@ -148,6 +149,9 @@ SCANDIRAT (dfd, dir, namelist, select, cmp)
   return c.cnt;
 }
 libc_hidden_def (SCANDIRAT)
+#ifdef SCANDIRAT_WEAK_ALIAS
+weak_alias (__scandirat, scandirat)
+#endif
 
 #ifdef _DIRENT_MATCHES_DIRENT64
 weak_alias (scandirat, scandirat64)