Avoid local PLT for dirfd
This commit is contained in:
parent
1aff59a3f7
commit
fabe2a9514
2
io/fts.c
2
io/fts.c
@ -654,7 +654,7 @@ fts_build(sp, type)
|
|||||||
*/
|
*/
|
||||||
cderrno = 0;
|
cderrno = 0;
|
||||||
if (nlinks || type == BREAD) {
|
if (nlinks || type == BREAD) {
|
||||||
if (fts_safe_changedir(sp, cur, dirfd(dirp), NULL)) {
|
if (fts_safe_changedir(sp, cur, __dirfd(dirp), NULL)) {
|
||||||
if (nlinks && type == BREAD)
|
if (nlinks && type == BREAD)
|
||||||
cur->fts_errno = errno;
|
cur->fts_errno = errno;
|
||||||
cur->fts_flags |= FTS_DONTCHDIR;
|
cur->fts_flags |= FTS_DONTCHDIR;
|
||||||
|
8
io/ftw.c
8
io/ftw.c
@ -1,5 +1,5 @@
|
|||||||
/* File tree walker functions.
|
/* File tree walker functions.
|
||||||
Copyright (C) 1996-2004, 2006-2008, 2010 Free Software Foundation, Inc.
|
Copyright (C) 1996-2004, 2006-2008, 2010, 2012 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||||
|
|
||||||
@ -365,7 +365,7 @@ open_dir_stream (int *dfdp, struct ftw_data *data, struct dir_data *dirp)
|
|||||||
result = -1;
|
result = -1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dirp->streamfd = dirfd (dirp->stream);
|
dirp->streamfd = __dirfd (dirp->stream);
|
||||||
dirp->content = NULL;
|
dirp->content = NULL;
|
||||||
data->dirstreams[data->actdir] = dirp;
|
data->dirstreams[data->actdir] = dirp;
|
||||||
|
|
||||||
@ -524,7 +524,7 @@ fail:
|
|||||||
/* If necessary, change to this directory. */
|
/* If necessary, change to this directory. */
|
||||||
if (data->flags & FTW_CHDIR)
|
if (data->flags & FTW_CHDIR)
|
||||||
{
|
{
|
||||||
if (__fchdir (dirfd (dir.stream)) < 0)
|
if (__fchdir (__dirfd (dir.stream)) < 0)
|
||||||
{
|
{
|
||||||
result = -1;
|
result = -1;
|
||||||
goto fail;
|
goto fail;
|
||||||
@ -604,7 +604,7 @@ fail:
|
|||||||
/* Change back to the parent directory. */
|
/* Change back to the parent directory. */
|
||||||
int done = 0;
|
int done = 0;
|
||||||
if (old_dir->stream != NULL)
|
if (old_dir->stream != NULL)
|
||||||
if (__fchdir (dirfd (old_dir->stream)) == 0)
|
if (__fchdir (__dirfd (old_dir->stream)) == 0)
|
||||||
done = 1;
|
done = 1;
|
||||||
|
|
||||||
if (!done)
|
if (!done)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011
|
/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
@ -1545,7 +1545,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
|
|||||||
{
|
{
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
int dfd = (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)
|
int dfd = (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)
|
||||||
? -1 : dirfd ((DIR *) stream));
|
? -1 : __dirfd ((DIR *) stream));
|
||||||
#endif
|
#endif
|
||||||
int fnm_flags = ((!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0)
|
int fnm_flags = ((!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0)
|
||||||
| ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)
|
| ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)
|
||||||
|
@ -25,7 +25,7 @@ close_all_fds (void)
|
|||||||
{
|
{
|
||||||
char *endp;
|
char *endp;
|
||||||
long int fd = strtol (d->d_name, &endp, 10);
|
long int fd = strtol (d->d_name, &endp, 10);
|
||||||
if (*endp == '\0' && fd != PTY_FILENO && fd != dirfd (dir))
|
if (*endp == '\0' && fd != PTY_FILENO && fd != __dirfd (dir))
|
||||||
close_not_cancel_no_status (fd);
|
close_not_cancel_no_status (fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user