* lib/fts.c (fts_read): Upon failure to chdir into a subdirectory,
authorJim Meyering <jim@meyering.net>
Mon, 30 Jul 2007 12:16:34 +0000 (12:16 +0000)
committerJim Meyering <jim@meyering.net>
Mon, 30 Jul 2007 12:16:34 +0000 (12:16 +0000)
set fts_info to FTS_DNR, not to FTS_ERR, so that the caller knows
it has valid stat data.  This bug would cause du not to count the
sizes of inaccessible directories.
Patch by Jose Maria Plans, reported in http://bugzilla.redhat.com/250077

ChangeLog
lib/fts.c

index e3286fb..b9f9d29 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-07-30  Jim Meyering  <jim@meyering.net>
+
+       * lib/fts.c (fts_read): Upon failure to chdir into a subdirectory,
+       set fts_info to FTS_DNR, not to FTS_ERR, so that the caller knows
+       it has valid stat data.  This bug would cause du not to count the
+       sizes of inaccessible directories.
+       Patch by Jose Maria Plans, reported in http://bugzilla.redhat.com/250077
+
 2007-07-25  Peter O'Gorman  <peter@pogma.com>
             Bruno Haible  <bruno@clisp.org>
 
index 1b5384b..ccf6b19 100644 (file)
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -685,7 +685,7 @@ fts_read (register FTS *sp)
                        /* If fts_build's call to fts_safe_changedir failed
                           because it was not able to fchdir into a
                           subdirectory, tell the caller.  */
-                       if (p->fts_errno)
+                       if (p->fts_errno && p->fts_info != FTS_DNR)
                                p->fts_info = FTS_ERR;
                        LEAVE_DIR (sp, p, "2");
                        return (p);