From 24852bf5b5e7fd954f2e4d1d08d58575453b48b0 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 14 Dec 2006 11:09:44 +0100 Subject: * 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. --- src/chmod.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/chmod.c') 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; } -- cgit v1.2.3-54-g00ecf