mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 01:33:36 +08:00
[BZ #4076]
* io/ftw.c (ftw_startup): Handle special case of FTW_CHDIR in /. (open_dir_stream): Likewise. * io/Makefile (tests): Add bug-ftw5. io/bug-ftw5.c: New file.
This commit is contained in:
parent
c8703f8849
commit
63a2f30529
@ -1,5 +1,11 @@
|
||||
2007-02-21 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
[BZ #4076]
|
||||
* io/ftw.c (ftw_startup): Handle special case of FTW_CHDIR in /.
|
||||
(open_dir_stream): Likewise.
|
||||
* io/Makefile (tests): Add bug-ftw5.
|
||||
io/bug-ftw5.c: New file.
|
||||
|
||||
* nscd/hstcache.c (cache_addhst): Remove unnecessary conditional.
|
||||
* nscd/servicescache.c (cache_addserv): Likewise.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 1992-2002,2003,2005,2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1992-2002,2003,2005,2006, 2007 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -66,7 +66,7 @@ tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \
|
||||
tst-openat tst-unlinkat tst-fstatat tst-futimesat \
|
||||
tst-renameat tst-fchownat tst-fchmodat tst-faccessat \
|
||||
tst-symlinkat tst-linkat tst-readlinkat tst-mkdirat \
|
||||
tst-mknodat tst-mkfifoat tst-ttyname_r
|
||||
tst-mknodat tst-mkfifoat tst-ttyname_r bug-ftw5
|
||||
|
||||
distribute := ftwtest-sh
|
||||
|
||||
|
25
io/bug-ftw5.c
Normal file
25
io/bug-ftw5.c
Normal file
@ -0,0 +1,25 @@
|
||||
#include <errno.h>
|
||||
#include <ftw.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static int
|
||||
fn (const char *file, const struct stat *sb, int flag, struct FTW *s)
|
||||
{
|
||||
puts (file);
|
||||
return FTW_STOP;
|
||||
}
|
||||
|
||||
static int
|
||||
do_test (void)
|
||||
{
|
||||
if (nftw ("/", fn, 0, FTW_CHDIR | FTW_ACTIONRETVAL) < 0)
|
||||
{
|
||||
printf ("nftw / FTW_CHDIR: %m\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
28
io/ftw.c
28
io/ftw.c
@ -1,5 +1,5 @@
|
||||
/* File tree walker functions.
|
||||
Copyright (C) 1996-2003, 2004, 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996-2003, 2004, 2006, 2007 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
|
||||
@ -348,8 +348,17 @@ open_dir_stream (int *dfdp, struct ftw_data *data, struct dir_data *dirp)
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *name = ((data->flags & FTW_CHDIR)
|
||||
? data->dirbuf + data->ftw.base: data->dirbuf);
|
||||
const char *name;
|
||||
|
||||
if (data->flags & FTW_CHDIR)
|
||||
{
|
||||
name = data->dirbuf + data->ftw.base;
|
||||
if (name[0] == '\0')
|
||||
name = ".";
|
||||
}
|
||||
else
|
||||
name = data->dirbuf;
|
||||
|
||||
dirp->stream = __opendir (name);
|
||||
}
|
||||
|
||||
@ -721,9 +730,16 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors,
|
||||
/* Get stat info for start directory. */
|
||||
if (result == 0)
|
||||
{
|
||||
const char *name = ((data.flags & FTW_CHDIR)
|
||||
? data.dirbuf + data.ftw.base
|
||||
: data.dirbuf);
|
||||
const char *name;
|
||||
|
||||
if (data.flags & FTW_CHDIR)
|
||||
{
|
||||
name = data.dirbuf + data.ftw.base;
|
||||
if (name[0] == '\0')
|
||||
name = ".";
|
||||
}
|
||||
else
|
||||
name = data.dirbuf;
|
||||
|
||||
if (((flags & FTW_PHYS)
|
||||
? LXSTAT (_STAT_VER, name, &st)
|
||||
|
@ -1,3 +1,8 @@
|
||||
2007-02-21 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* sysdeps/pthread/pthread-functions.h: Correct last patch, correct
|
||||
PTHFCT_CALL definition.
|
||||
|
||||
2007-02-18 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* sysdeps/pthread/pthread-functions.h: If PTR_DEMANGLE is not
|
||||
|
Loading…
Reference in New Issue
Block a user