]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Avoid a used-uninitialized error.
authorJim Meyering <meyering@redhat.com>
Sun, 7 Oct 2007 14:06:59 +0000 (16:06 +0200)
committerJim Meyering <meyering@redhat.com>
Sun, 7 Oct 2007 14:56:46 +0000 (16:56 +0200)
* src/copy.c (copy_internal): Don't overload "use_stat".

ChangeLog
src/copy.c

index e9946ddf9efb8d7a0a67e4d22fd16c61b7d84012..dd381fccb6a8255c07e54116454cf42672c8030f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
index 1ba28ed5f181db281afa054ecd0bea011b9544a7..e1cd5fa21cf41acd6fe38a915cb3a4cbb454c23b 100644 (file)
@@ -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
        {