]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Include "root-dev-ino.h".
authorJim Meyering <jim@meyering.net>
Sun, 9 Nov 2003 21:07:31 +0000 (21:07 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 9 Nov 2003 21:07:31 +0000 (21:07 +0000)
(chopt_init): Initialize new member.
(change_file_owner): Support rm's new --preserve-root option.

src/chown-core.c

index 3d95bc5a3199edd465f64fff2fcb0dad2893a200..ba2c5c3df7f4177a589057b88430bd03a4bcbae8 100644 (file)
@@ -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))
     {