From: Jim Meyering Date: Sun, 9 Nov 2003 21:07:31 +0000 (+0000) Subject: Include "root-dev-ino.h". X-Git-Tag: v5.1.0~192 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2c165a173a1379ce4d6ac8a9400d79c4fa7ef0b;p=thirdparty%2Fcoreutils.git Include "root-dev-ino.h". (chopt_init): Initialize new member. (change_file_owner): Support rm's new --preserve-root option. --- diff --git a/src/chown-core.c b/src/chown-core.c index 3d95bc5a31..ba2c5c3df7 100644 --- a/src/chown-core.c +++ b/src/chown-core.c @@ -28,6 +28,7 @@ #include "xfts.h" #include "lchown.h" #include "quote.h" +#include "root-dev-ino.h" #include "savedir.h" #include "chown-core.h" @@ -44,6 +45,7 @@ void chopt_init (struct Chown_option *chopt) { chopt->verbosity = V_off; + chopt->root_dev_ino = NULL; chopt->affect_symlink_referent = false; chopt->recurse = false; chopt->force_silent = false; @@ -188,7 +190,6 @@ change_file_owner (FTS *fts, FTSENT *ent, return 1; case FTS_ERR: - /* if (S_ISDIR (ent->fts_statp->st_mode) && FIXME */ error (0, ent->fts_errno, _("%s"), quote (file_full_name)); return 1; @@ -201,6 +202,12 @@ change_file_owner (FTS *fts, FTSENT *ent, break; } + if (ROOT_DEV_INO_CHECK (chopt->root_dev_ino, file_stats)) + { + ROOT_DEV_INO_WARN (file_full_name); + return 1; + } + if ((old_uid == (uid_t) -1 || file_stats->st_uid == old_uid) && (old_gid == (gid_t) -1 || file_stats->st_gid == old_gid)) {