diff options
author | Jim Meyering <meyering@redhat.com> | 2007-10-07 16:06:59 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2007-10-07 16:56:46 +0200 |
commit | fbaf2fbb184d860755dd6c27c7b32058d1668e13 (patch) | |
tree | e205a82088f81d509513edc614afa07c330c53e3 | |
parent | b4148f567d9bf7abc8e82a6f2e252f28da93f354 (diff) | |
download | coreutils-fbaf2fbb184d860755dd6c27c7b32058d1668e13.tar.xz |
Avoid a used-uninitialized error.
* src/copy.c (copy_internal): Don't overload "use_stat".
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/copy.c | 7 |
2 files changed, 9 insertions, 3 deletions
@@ -1,3 +1,8 @@ +2007-10-07 Jim Meyering <meyering@redhat.com> + + Avoid a used-uninitialized error. + * src/copy.c (copy_internal): Don't overload "use_stat". + 2007-10-05 Jim Meyering <meyering@redhat.com> Make a failing cross-partition mv give a sensible diagnostic. diff --git a/src/copy.c b/src/copy.c index 1ba28ed5f..e1cd5fa21 100644 --- a/src/copy.c +++ b/src/copy.c @@ -1008,7 +1008,7 @@ copy_internal (char const *src_name, char const *dst_name, bool delayed_ok; bool copied_as_regular = false; bool preserve_metadata; - bool use_stat = true; + bool have_dst_lstat = false; if (x->move_mode && rename_succeeded) *rename_succeeded = false; @@ -1055,7 +1055,7 @@ copy_internal (char const *src_name, char const *dst_name, However, if we intend to unlink or remove the destination first, use lstat, since a copy won't actually be made to the destination in that case. */ - use_stat = + bool use_stat = ((S_ISREG (src_mode) || (x->copy_as_regular && ! (S_ISDIR (src_mode) || S_ISLNK (src_mode)))) @@ -1083,6 +1083,7 @@ copy_internal (char const *src_name, char const *dst_name, bool return_now; bool unlink_src; + have_dst_lstat = !use_stat; if (! same_file_ok (src_name, &src_sb, dst_name, &dst_sb, x, &return_now, &unlink_src)) { @@ -1313,7 +1314,7 @@ copy_internal (char const *src_name, char const *dst_name, /* If we called lstat above, good: use that data. Otherwise, call lstat here, in case dst_name is a symlink. */ - if ( ! use_stat) + if (have_dst_lstat) dst_lstat_sb = &dst_sb; else { |