]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix scandir scandirat namespace (bug 17999).
authorJoseph Myers <joseph@codesourcery.com>
Thu, 19 Feb 2015 17:18:51 +0000 (17:18 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Thu, 19 Feb 2015 17:18:51 +0000 (17:18 +0000)
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.

ChangeLog
NEWS
conform/Makefile
dirent/scandir.c
dirent/scandirat.c
include/dirent.h

index 8b6dd07140dcbc77c56230f88af654dd1e466f39..b09206cd363d2ec08411bac53616b76abd05736a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2015-02-19  Joseph Myers  <joseph@codesourcery.com>
+
+       [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.
+
 2015-02-18  Joseph Myers  <joseph@codesourcery.com>
 
        [BZ #15319]
diff --git a/NEWS b/NEWS
index 0501d51132c57953b04dfddce17dc3dd37ca553e..8d2c51bc10bf01d0eadaea7bf21cc6c5c7b37d69 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,7 +10,7 @@ Version 2.22
 * The following bugs are resolved with this release:
 
   4719, 15319, 15467, 15790, 16560, 17569, 17792, 17912, 17932, 17944,
-  17949, 17964, 17965, 17967, 17969, 17978, 17987, 17991, 17996.
+  17949, 17964, 17965, 17967, 17969, 17978, 17987, 17991, 17996, 17999.
 \f
 Version 2.21
 
index 39f41bd7c5831be66e42cf6d234523640abee771..3f9721abdf9188d619594b089e03c605c58faa8e 100644 (file)
@@ -393,13 +393,11 @@ test-xfail-XOPEN2K/syslog.h/linknamespace = yes
 test-xfail-XOPEN2K/ucontext.h/linknamespace = yes
 test-xfail-XOPEN2K/unistd.h/linknamespace = yes
 test-xfail-XOPEN2K/wordexp.h/linknamespace = yes
-test-xfail-POSIX2008/dirent.h/linknamespace = yes
 test-xfail-POSIX2008/grp.h/linknamespace = yes
 test-xfail-POSIX2008/netdb.h/linknamespace = yes
 test-xfail-POSIX2008/regex.h/linknamespace = yes
 test-xfail-POSIX2008/semaphore.h/linknamespace = yes
 test-xfail-POSIX2008/unistd.h/linknamespace = yes
-test-xfail-XOPEN2K8/dirent.h/linknamespace = yes
 test-xfail-XOPEN2K8/fmtmsg.h/linknamespace = yes
 test-xfail-XOPEN2K8/grp.h/linknamespace = yes
 test-xfail-XOPEN2K8/netdb.h/linknamespace = yes
index 1039b9b968f44283424b47723fd74bc6b342ec87..99c968181c4a9f57c97f27314543f1e4947dac54 100644 (file)
@@ -28,7 +28,7 @@
 
 #ifndef SCANDIR
 # define SCANDIR scandir
-# define SCANDIRAT scandirat
+# define SCANDIRAT __scandirat
 # define DIRENT_TYPE struct dirent
 #endif
 
index 1147cee43f0edd9eb3be025ac40d036b1eda0843..004b1527f32d50ce9ce06089bed0497eeb173619 100644 (file)
 #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)
index e8e9e42de6ec0348989e5d51f82f4ea752c94cc3..2e797ae5ad8f700cdb6180503c6b5ee52ff8101e 100644 (file)
@@ -50,7 +50,8 @@ extern void __scandir_cancel_handler (void *arg);
 extern __typeof (rewinddir) __rewinddir;
 
 libc_hidden_proto (__rewinddir)
-libc_hidden_proto (scandirat)
+extern __typeof (scandirat) __scandirat;
+libc_hidden_proto (__scandirat)
 libc_hidden_proto (scandirat64)
 # endif