aboutsummaryrefslogtreecommitdiff
path: root/io/ftw.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-31 13:33:18 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-31 13:33:18 +0000
commit32c075e1f01849e161724bbd400ba77244e482cc (patch)
tree5f083a3f352104f32bb6c902d57fa3f294bd8d4d /io/ftw.c
parentd6220e9ee38c1c9285221b023346201ec5f511b3 (diff)
downloadglibc-32c075e1f01849e161724bbd400ba77244e482cc.zip
glibc-32c075e1f01849e161724bbd400ba77244e482cc.tar.gz
glibc-32c075e1f01849e161724bbd400ba77244e482cc.tar.bz2
.
Diffstat (limited to 'io/ftw.c')
-rw-r--r--io/ftw.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/io/ftw.c b/io/ftw.c
index 4138717..5495bc7 100644
--- a/io/ftw.c
+++ b/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)