From 32c075e1f01849e161724bbd400ba77244e482cc Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 31 Jul 2007 13:33:18 +0000 Subject: . --- io/ftw.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'io/ftw.c') 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 , 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) -- cgit v1.1