diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2017-09-27 23:46:51 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2017-09-28 00:49:05 +0200 |
commit | 2c7bbfaf4e361b482f3ccfbdbb29cc5121ca0ea8 (patch) | |
tree | 43dbd812c9322f390f90d39d85f325bbc7d1cfd8 | |
parent | 825adeeed1e95990fd1efb70d9ac3eb7f1ea802a (diff) | |
download | glibc-2c7bbfaf4e361b482f3ccfbdbb29cc5121ca0ea8.tar.gz glibc-2c7bbfaf4e361b482f3ccfbdbb29cc5121ca0ea8.tar.xz glibc-2c7bbfaf4e361b482f3ccfbdbb29cc5121ca0ea8.zip |
hurd: Fix dirfd symbol exposition from ftw
dirfd is XOPEN2K8 only, it should not be exposed along ftw which is earlier. * include/dirent.h (__dirfd): New declaration. * dirent/dirfd.c (dirfd): Rename to __dirfd, and redefine as weak alias. * sysdeps/posix/dirfd/dirfd.c (dirfd): Likewise. * sysdeps/mach/hurd/dirfd.c (dirfd): Likewise. * io/ftw.c (open_dir_stream, ftw_dir): Use __dirfd instead of dirfd.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | dirent/dirfd.c | 3 | ||||
-rw-r--r-- | include/dirent.h | 1 | ||||
-rw-r--r-- | io/ftw.c | 6 | ||||
-rw-r--r-- | sysdeps/mach/hurd/dirfd.c | 4 | ||||
-rw-r--r-- | sysdeps/posix/dirfd.c | 4 |
6 files changed, 21 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog index a731980f80..a535da875c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-09-27 Samuel Thibault <samuel.thibault@ens-lyon.org> + + * include/dirent.h (__dirfd): New declaration. + * dirent/dirfd.c (dirfd): Rename to __dirfd, and redefine as weak + alias. + * sysdeps/posix/dirfd/dirfd.c (dirfd): Likewise. + * sysdeps/mach/hurd/dirfd.c (dirfd): Likewise. + * io/ftw.c (open_dir_stream, ftw_dir): Use __dirfd instead of dirfd. + 2017-09-26 H.J. Lu <hongjiu.lu@intel.com> [BZ #18822] diff --git a/dirent/dirfd.c b/dirent/dirfd.c index 7af77adf01..c1069ffb80 100644 --- a/dirent/dirfd.c +++ b/dirent/dirfd.c @@ -21,10 +21,11 @@ #include <errno.h> int -dirfd (DIR *dirp) +__dirfd (DIR *dirp) { __set_errno (ENOSYS); return -1; } +weak_alias (__dirfd, dirfd) stub_warning (dirfd) diff --git a/include/dirent.h b/include/dirent.h index bebcd52cdb..5720d589a2 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -46,6 +46,7 @@ extern int __versionsort64 (const struct dirent64 **a, extern DIR *__alloc_dir (int fd, bool close_fd, int flags, const struct stat64 *statp) attribute_hidden; extern __typeof (rewinddir) __rewinddir; +extern __typeof (dirfd) __dirfd; extern void __scandir_cancel_handler (void *arg) attribute_hidden; extern int __scandir_tail (DIR *dp, diff --git a/io/ftw.c b/io/ftw.c index 63448e188a..6cca0e4cbc 100644 --- a/io/ftw.c +++ b/io/ftw.c @@ -361,7 +361,7 @@ open_dir_stream (int *dfdp, struct ftw_data *data, struct dir_data *dirp) result = -1; else { - dirp->streamfd = dirfd (dirp->stream); + dirp->streamfd = __dirfd (dirp->stream); dirp->content = NULL; data->dirstreams[data->actdir] = dirp; @@ -518,7 +518,7 @@ fail: /* If necessary, change to this directory. */ if (data->flags & FTW_CHDIR) { - if (__fchdir (dirfd (dir.stream)) < 0) + if (__fchdir (__dirfd (dir.stream)) < 0) { result = -1; goto fail; @@ -602,7 +602,7 @@ fail: /* Change back to the parent directory. */ int done = 0; if (old_dir->stream != NULL) - if (__fchdir (dirfd (old_dir->stream)) == 0) + if (__fchdir (__dirfd (old_dir->stream)) == 0) done = 1; if (!done) diff --git a/sysdeps/mach/hurd/dirfd.c b/sysdeps/mach/hurd/dirfd.c index 0ad290d515..65673336e3 100644 --- a/sysdeps/mach/hurd/dirfd.c +++ b/sysdeps/mach/hurd/dirfd.c @@ -22,7 +22,7 @@ #include <errno.h> int -dirfd (DIR *dirp) +__dirfd (DIR *dirp) { int fd; @@ -41,3 +41,5 @@ dirfd (DIR *dirp) return fd; } + +weak_alias (__dirfd, dirfd) diff --git a/sysdeps/posix/dirfd.c b/sysdeps/posix/dirfd.c index fee8326d93..ce779c50ae 100644 --- a/sysdeps/posix/dirfd.c +++ b/sysdeps/posix/dirfd.c @@ -22,7 +22,9 @@ #undef dirfd int -dirfd (DIR *dirp) +__dirfd (DIR *dirp) { return dirp->fd; } + +weak_alias (__dirfd, dirfd) |