]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Include "root-dev-ino.h".
authorJim Meyering <jim@meyering.net>
Sun, 9 Nov 2003 21:06:16 +0000 (21:06 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 9 Nov 2003 21:06:16 +0000 (21:06 +0000)
(remove_cwd_entries): Remove now-obsolete FIXME comment.
(remove_dir): Support rm's new --preserve-root option.

src/remove.c

index 0e0a970f2e64cd8a80af942bb65a8385f88cfbfd..06071677af9db7fbb50b31287688d2cd2ab89929 100644 (file)
@@ -35,6 +35,7 @@
 #include "obstack.h"
 #include "quote.h"
 #include "remove.h"
+#include "root-dev-ino.h"
 
 /* Avoid shadowing warnings because these are functions declared
    in dirname.h as well as locals used below.  */
@@ -889,10 +890,6 @@ remove_cwd_entries (Dirstack_state *ds, char **subdir, struct stat *subdir_sb,
              error (EXIT_FAILURE, errno, _("cannot lstat %s"),
                     quote (full_filename (f)));
 
-           /* FIXME: here (if F is a command line argument) is at least one
-              place in which we'll have to compare the dev/ino against those
-              of `/', in implementing fail-to-remove-root-dir semantics.  */
-
            if (chdir (f))
              {
                /* It is much more common that we reach this point for an
@@ -1020,6 +1017,12 @@ remove_dir (Dirstack_state *ds, char const *dir, struct saved_cwd **cwd_state,
       return RM_ERROR;
     }
 
+  if (ROOT_DEV_INO_CHECK (x->root_dev_ino, &dir_sb))
+    {
+      ROOT_DEV_INO_WARN (full_filename (dir));
+      return 1;
+    }
+
   AD_push (ds, dir, &dir_sb);
   AD_INIT_OTHER_MEMBERS ();