summaryrefslogtreecommitdiff
path: root/src/chown-core.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-11-07 08:09:12 +0100
committerJim Meyering <meyering@redhat.com>2009-11-07 08:43:00 +0100
commitd9dbbb9a455f6bfc4e09d9f5f6c6c633f1b03c52 (patch)
tree54ab2f41b2d2de1918d2b18913df819d0b6cfbba /src/chown-core.c
parent74cf4cb26dcecd36eb45dc00dbd4587d9dc24a2f (diff)
downloadcoreutils-d9dbbb9a455f6bfc4e09d9f5f6c6c633f1b03c52.tar.xz
chcon, chgrp, chmod and chown now diagnose a directory cycle
* lib/xfts.c (cycle_warning_required): New function. * lib/xfts.h: Declare it. * src/chown-core.c (change_file_owner): Diagnose a cycle. * src/chmod.c (process_file): Likewise. * src/chcon.c (process_file): Likewise. * NEWS (Bug fixes): Mention this.
Diffstat (limited to 'src/chown-core.c')
-rw-r--r--src/chown-core.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/chown-core.c b/src/chown-core.c
index e7dacf68c..eaebe60f9 100644
--- a/src/chown-core.c
+++ b/src/chown-core.c
@@ -316,6 +316,14 @@ change_file_owner (FTS *fts, FTSENT *ent,
ok = false;
break;
+ case FTS_DC: /* directory that causes cycles */
+ if (cycle_warning_required (fts, ent))
+ {
+ emit_cycle_warning (file_full_name);
+ return false;
+ }
+ break;
+
default:
break;
}