summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-11-09 21:07:31 +0000
committerJim Meyering <jim@meyering.net>2003-11-09 21:07:31 +0000
commitc2c165a173a1379ce4d6ac8a9400d79c4fa7ef0b (patch)
tree1b32ab18f6615ea8275cb995972d22b93a005542 /src
parent70698e5bc7fa5bb7862b8adaecea37b0a9778440 (diff)
downloadcoreutils-c2c165a173a1379ce4d6ac8a9400d79c4fa7ef0b.tar.xz
Include "root-dev-ino.h".
(chopt_init): Initialize new member. (change_file_owner): Support rm's new --preserve-root option.
Diffstat (limited to 'src')
-rw-r--r--src/chown-core.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/chown-core.c b/src/chown-core.c
index 3d95bc5a3..ba2c5c3df 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))
{