]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(do_copy): Set backup_type to `none' only *after*
authorJim Meyering <jim@meyering.net>
Sun, 8 Sep 1996 17:55:24 +0000 (17:55 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 8 Sep 1996 17:55:24 +0000 (17:55 +0000)
calling to find_backup_file_name.  Reported by Eli Zaretskii.

src/cp.c

index 98894a3dd4bd7afc1c86d2b5ea764566cf90cecf..74b7c2d9615de40076d6bf97f2021ff946d44043 100644 (file)
--- a/src/cp.c
+++ b/src/cp.c
@@ -507,8 +507,13 @@ do_copy (int argc, char **argv)
          && STREQ (source, dest)
          && !new_dst && S_ISREG (sb.st_mode))
        {
-         backup_type = none;
          new_dest = find_backup_file_name (dest);
+         /* Set backup_type to `none' so that the normal backup
+            mechanism is not used when performing the actual copy.
+            backup_type must be set to `none' only *after* the above
+            call to find_backup_file_name -- that function uses
+            backup_type to determine the suffix it applies.  */
+         backup_type = none;
          if (new_dest == NULL)
            error (1, 0, _("virtual memory exhausted"));
        }