]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
hurd: Fix dirfd symbol exposition from ftw
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Wed, 27 Sep 2017 21:46:51 +0000 (23:46 +0200)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Wed, 27 Sep 2017 22:49:05 +0000 (00:49 +0200)
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.

ChangeLog
dirent/dirfd.c
include/dirent.h
io/ftw.c
sysdeps/mach/hurd/dirfd.c
sysdeps/posix/dirfd.c

index a731980f8028d77cf74f686c7723a3373d8fa8bc..a535da875c53c5d18d22b63be5c81f12b725bd58 100644 (file)
--- 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]
index 7af77adf01af235cf6d2938d7212eece44bc6429..c1069ffb8034edd9fc4c1dbdfcc9b9381b48c9e1 100644 (file)
 #include <errno.h>
 
 int
-dirfd (DIR *dirp)
+__dirfd (DIR *dirp)
 {
   __set_errno (ENOSYS);
   return -1;
 }
 
+weak_alias (__dirfd, dirfd)
 stub_warning (dirfd)
index bebcd52cdb569b6f7e44159a2774788918eeb719..5720d589a26e31faaa63a01dd5e88cd81d770657 100644 (file)
@@ -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,
index 63448e188a180810248dc8c0956e3f51736654b9..6cca0e4cbc30835f5f298be0cd9e350c80791085 100644 (file)
--- 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)
index 0ad290d5156f94161c1a40f051195bbf09c7ef07..65673336e35840ef2bf8ee24ccb4df8a9aae6cb4 100644 (file)
@@ -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)
index fee8326d9372a99f16620cf565d59eae1a73b70a..ce779c50aedc9f8baf7063ccda17424b6d564f40 100644 (file)
@@ -22,7 +22,9 @@
 #undef dirfd
 
 int
-dirfd (DIR *dirp)
+__dirfd (DIR *dirp)
 {
   return dirp->fd;
 }
+
+weak_alias (__dirfd, dirfd)