]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(ftw_startup): When using FTW_CHDIR, always remember
authorJim Meyering <jim@meyering.net>
Sat, 8 Feb 2003 17:07:38 +0000 (17:07 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 8 Feb 2003 17:07:38 +0000 (17:07 +0000)
the current directory, not just when DIR contains a slash.

lib/ftw.c

index 982b047c3e4622080dee66f6f7b01dc38a7cc734..b3dd2fc706d901b9f6f6ccf7d04fbb943a3b9224 100644 (file)
--- a/lib/ftw.c
+++ b/lib/ftw.c
@@ -691,13 +691,13 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors,
   data.known_objects = NULL;
 
   /* Now go to the directory containing the initial file/directory.  */
-  if ((flags & FTW_CHDIR) && data.ftw.base > 0)
+  if (flags & FTW_CHDIR)
     {
       /* GNU extension ahead.  */
       cwd =  __getcwd (NULL, 0);
       if (cwd == NULL)
        result = -1;
-      else
+      else if (data.ftw.base > 0)
        {
          /* Change to the directory the file is in.  In data.dirbuf
             we have a writable copy of the file name.  Just NUL