summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2006-11-25 11:13:05 +0100
committerJim Meyering <jim@meyering.net>2006-11-26 17:40:37 +0100
commita23c91026d542709fa28163e9072be191ff44157 (patch)
treee2bf8388661b9b7b2423690a22fd18a5b482ab12
parent1ce71652fc07fae67ddb5254856dd030502d509c (diff)
downloadcoreutils-a23c91026d542709fa28163e9072be191ff44157.tar.xz
* src/remove.c (rm): Move cycle_check_init call into callee...
Use an else clause in place of a "continue" statement. Signed-off-by: Paul Eggert <eggert@cs.ucla.edu>
-rw-r--r--ChangeLog3
-rw-r--r--src/remove.c13
2 files changed, 10 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 65961560c..5152963aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,9 @@
(AD_ensure_initialized): New function.
(AD_mark_helper): Use it, to avoid the need for declaration
after statement.
+ (rm): Move cycle_check_init call into callee...
+ (rm_1): ...here.
+ Use an else clause in place of a "continue" statement.
2006-11-25 Jim Meyering <jim@meyering.net>
diff --git a/src/remove.c b/src/remove.c
index f6fee66a9..06d2f82b4 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -1479,6 +1479,7 @@ rm_1 (Dirstack_state *ds, char const *filename,
struct stat st;
cache_stat_init (&st);
+ cycle_check_init (&ds->cycle_check_state);
if (x->root_dev_ino)
{
if (cache_fstatat (AT_FDCWD, filename, &st, AT_SYMLINK_NOFOLLOW) != 0)
@@ -1532,13 +1533,13 @@ rm (size_t n_files, char const *const *file, struct rm_options const *x)
{
error (0, 0, _("cannot remove relative-named %s"), quote (file[i]));
status = RM_ERROR;
- continue;
}
-
- cycle_check_init (&ds->cycle_check_state);
- enum RM_status s = rm_1 (ds, file[i], x, &cwd_errno);
- assert (VALID_STATUS (s));
- UPDATE_STATUS (status, s);
+ else
+ {
+ enum RM_status s = rm_1 (ds, file[i], x, &cwd_errno);
+ assert (VALID_STATUS (s));
+ UPDATE_STATUS (status, s);
+ }
}
if (x->require_restore_cwd && cwd_errno)