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.
+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]
#include <errno.h>
int
-dirfd (DIR *dirp)
+__dirfd (DIR *dirp)
{
__set_errno (ENOSYS);
return -1;
}
+weak_alias (__dirfd, dirfd)
stub_warning (dirfd)
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,
result = -1;
else
{
- dirp->streamfd = dirfd (dirp->stream);
+ dirp->streamfd = __dirfd (dirp->stream);
dirp->content = NULL;
data->dirstreams[data->actdir] = dirp;
/* 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;
/* 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)
#include <errno.h>
int
-dirfd (DIR *dirp)
+__dirfd (DIR *dirp)
{
int fd;
return fd;
}
+
+weak_alias (__dirfd, dirfd)
#undef dirfd
int
-dirfd (DIR *dirp)
+__dirfd (DIR *dirp)
{
return dirp->fd;
}
+
+weak_alias (__dirfd, dirfd)