summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-09-11 13:22:04 +0000
committerJim Meyering <jim@meyering.net>2006-09-11 13:22:04 +0000
commit75b99e8f20be498c1e87ea57a8db0a8afafb9eb6 (patch)
treef04ef30a39aa969471ba9ea3bc6e7bd9ada1a450
parentd28b0d4de83f21c85f273cbf8cba3f7b68e42ff5 (diff)
downloadcoreutils-75b99e8f20be498c1e87ea57a8db0a8afafb9eb6.tar.xz
* src/remove.c (remove_dir): Move new cache_stat_init call onto
it's own line. (rm_1): Move declaration of "st" and new cache_stat_init call "down" to nearer where they're used.
-rw-r--r--ChangeLog7
-rw-r--r--src/remove.c9
2 files changed, 12 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index ff97f70b5..13fa38704 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-09-11 Jim Meyering <jim@meyering.net>
+
+ * src/remove.c (remove_dir): Move new cache_stat_init call onto
+ it's own line.
+ (rm_1): Move declaration of "st" and new cache_stat_init call
+ "down" to nearer where they're used.
+
2006-09-10 Paul Eggert <eggert@cs.ucla.edu>
* src/expr.c (eval6): Fix buffer overrun, or bad performance, if
diff --git a/src/remove.c b/src/remove.c
index cda1d30d4..670ba485b 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -1346,8 +1346,9 @@ remove_dir (int fd_cwd, Dirstack_state *ds, char const *dir,
prompts the user. E.g., we already know that D is a directory
and that it's almost certainly empty, yet we lstat it.
But that's no big deal since we're interactive. */
- struct stat empty_st; cache_stat_init (&empty_st);
+ struct stat empty_st;
Ternary is_empty;
+ cache_stat_init (&empty_st);
enum RM_status s = prompt (fd, ds, empty_dir, &empty_st, x,
PA_REMOVE_DIR, &is_empty);
@@ -1403,9 +1404,6 @@ static enum RM_status
rm_1 (Dirstack_state *ds, char const *filename,
struct rm_options const *x, int *cwd_errno)
{
- struct stat st;
- cache_stat_init (&st);
-
char const *base = last_component (filename);
if (dot_or_dotdot (base))
{
@@ -1415,6 +1413,9 @@ rm_1 (Dirstack_state *ds, char const *filename,
quote_n (0, base), quote_n (1, filename));
return RM_ERROR;
}
+
+ struct stat st;
+ cache_stat_init (&st);
if (x->root_dev_ino)
{
if (cache_fstatat (AT_FDCWD, filename, &st, AT_SYMLINK_NOFOLLOW) != 0)