aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--dirent/dirfd.c3
-rw-r--r--include/dirent.h1
-rw-r--r--io/ftw.c6
-rw-r--r--sysdeps/mach/hurd/dirfd.c4
-rw-r--r--sysdeps/posix/dirfd.c4
6 files changed, 21 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index a731980..a535da8 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 7af77ad..c1069ff 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 bebcd52..5720d58 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 63448e1..6cca0e4 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 0ad290d..6567333 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 fee8326..ce779c5 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)