bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: chgrp, chown: tiny change


From: Jim Meyering
Subject: FYI: chgrp, chown: tiny change
Date: Sat, 21 Oct 2006 01:09:14 +0200

I've just checked in this change:

2006-10-21  Jim Meyering  <address@hidden>

        Enable an fts optimization (call lstat only for directories,
        on some file system types) also with the --preserve-root option
        of chown or chgrp.
        * src/chown-core.c (change_file_owner): Compare fts_statp-based
        dev/ino against root dev/ino only for directories.
        (chown_files): Don't let the root_dev_ino setting influence whether
        we use FTS_NOSTAT: fts always sets *fts_statp for a directory.

Index: src/chown-core.c
===================================================================
RCS file: /fetish/cu/src/chown-core.c,v
retrieving revision 1.45
diff -u -r1.45 chown-core.c
--- src/chown-core.c    13 Oct 2006 21:11:54 -0000      1.45
+++ src/chown-core.c    20 Oct 2006 22:34:39 -0000
@@ -337,7 +337,12 @@
                      || required_gid == file_stats->st_gid));
     }

-  if (do_chown && ROOT_DEV_INO_CHECK (chopt->root_dev_ino, file_stats))
+  if (do_chown
+      /* With FTS_NOSTAT, file_stats is valid only for directories.
+        Don't need to check for FTS_D, since it is handled above,
+        and same for FTS_DNR, since then do_chown is false.  */
+      && (ent->fts_info == FTS_DP || ent->fts_info == FTS_DC)
+      && ROOT_DEV_INO_CHECK (chopt->root_dev_ino, file_stats))
     {
       ROOT_DEV_INO_WARN (file_full_name);
       ok = do_chown = false;
@@ -457,7 +462,7 @@
   /* Use lstat and stat only if they're needed.  */
   int stat_flags = ((required_uid != (uid_t) -1 || required_gid != (gid_t) -1
                     || chopt->affect_symlink_referent
-                    || chopt->verbosity != V_off || chopt->root_dev_ino)
+                    || chopt->verbosity != V_off)
                    ? 0
                    : FTS_NOSTAT);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]