git-dirfd-linknamespace
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Sun, 14 Jan 2018 10:24:48 +0000 (10:24 +0000)
committerAurelien Jarno <aurel32@debian.org>
Sun, 14 Jan 2018 10:24:48 +0000 (10:24 +0000)
commit 8f5238538d47e958cad2490732fbb27e7b1cd8ab
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Wed Sep 27 23:46:51 2017 +0200

    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.

+ glob in glibc 2.26, removed later

Gbp-Pq: Topic hurd-i386
Gbp-Pq: Name git-dirfd-linknamespace.diff

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

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 c792e53c96c150a8bc660664021d73018cb87444..9e72ae3ca6bfc4766dd18a32f732d75db43b75bb 100644 (file)
@@ -48,6 +48,7 @@ extern DIR *__alloc_dir (int fd, bool close_fd, int flags,
                         const struct stat64 *statp)
      internal_function 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 140a23774609a603a838853950143d4e5f5d7ef6..c8123885ff207d169e1141dc29f10cf0212f6613 100644 (file)
--- a/io/ftw.c
+++ b/io/ftw.c
@@ -363,7 +363,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;
 
@@ -522,7 +522,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;
@@ -606,7 +606,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 b2273ea7bce40552f3d45d74214868dec8cf232d..8d36cb158b484be9917dd709baab6e06c59d52e6 100644 (file)
@@ -1520,7 +1520,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
       else
        {
          int dfd = (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)
-                    ? -1 : dirfd ((DIR *) stream));
+                    ? -1 : __dirfd ((DIR *) stream));
          int fnm_flags = ((!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0)
                           | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0));
          flags |= GLOB_MAGCHAR;
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)