diff options
author | Jim Meyering <jim@meyering.net> | 2003-11-09 21:06:16 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2003-11-09 21:06:16 +0000 |
commit | 70698e5bc7fa5bb7862b8adaecea37b0a9778440 (patch) | |
tree | 31470a441108b741de9c1650bc209e4ed79a7d78 /src | |
parent | b23e9908003ac19d4b019a68de933a8ab880870d (diff) | |
download | coreutils-70698e5bc7fa5bb7862b8adaecea37b0a9778440.tar.xz |
Include "root-dev-ino.h".
(remove_cwd_entries): Remove now-obsolete FIXME comment.
(remove_dir): Support rm's new --preserve-root option.
Diffstat (limited to 'src')
-rw-r--r-- | src/remove.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/remove.c b/src/remove.c index 0e0a970f2..06071677a 100644 --- a/src/remove.c +++ b/src/remove.c @@ -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 (); |