summaryrefslogtreecommitdiff
path: root/src/chmod.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-12-14 11:09:44 +0100
committerJim Meyering <jim@meyering.net>2006-12-14 11:14:25 +0100
commit24852bf5b5e7fd954f2e4d1d08d58575453b48b0 (patch)
tree84eb0a48a2ec2d2b9637fa4d1890f941e4d5e647 /src/chmod.c
parent56007809c35dc4c3d139662578741281e11d0e3b (diff)
downloadcoreutils-24852bf5b5e7fd954f2e4d1d08d58575453b48b0.tar.xz
* NEWS: --preserve-root now works with chgrp, chmod, and chown.
* src/chmod.c (process_file): Do honor the --preserve-root option. * src/chown-core.c (change_file_owner): Likewise, but here, also handle the case in which a traversal would go "through" a symlink to root. Reported by Matthew M. Boedicker * tests/chown/preserve-root: Test for the above. * tests/chown/Makefile.am (TESTS): Add preserve-root.
Diffstat (limited to 'src/chmod.c')
-rw-r--r--src/chmod.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/chmod.c b/src/chmod.c
index 7858c0a66..028c882d0 100644
--- a/src/chmod.c
+++ b/src/chmod.c
@@ -228,6 +228,10 @@ process_file (FTS *fts, FTSENT *ent)
if (ok && ROOT_DEV_INO_CHECK (root_dev_ino, file_stats))
{
ROOT_DEV_INO_WARN (file_full_name);
+ /* Tell fts not to traverse into this hierarchy. */
+ fts_set (fts, ent, FTS_SKIP);
+ /* Ensure that we do not process "/" on the second visit. */
+ ent = fts_read (fts);
ok = false;
}