From 75b99e8f20be498c1e87ea57a8db0a8afafb9eb6 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 11 Sep 2006 13:22:04 +0000 Subject: [PATCH] * 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. --- ChangeLog | 7 +++++++ src/remove.c | 9 +++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index ff97f70..13fa387 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-09-11 Jim Meyering + + * 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 * src/expr.c (eval6): Fix buffer overrun, or bad performance, if diff --git a/src/remove.c b/src/remove.c index cda1d30..670ba48 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) -- 2.7.4