[NDEBUG]: Comment out definition.
authorJim Meyering <jim@meyering.net>
Thu, 22 Jan 1998 08:19:17 +0000 (08:19 +0000)
committerJim Meyering <jim@meyering.net>
Thu, 22 Jan 1998 08:19:17 +0000 (08:19 +0000)
(do_copy): Use x->backup_type, not the global.

src/cp.c

index a2814c2..57b9d17 100644 (file)
--- a/src/cp.c
+++ b/src/cp.c
@@ -25,7 +25,9 @@
 #include <stdio.h>
 #include <sys/types.h>
 
+/* FIXME: uncomment for release
 #define NDEBUG
+*/
 #include <assert.h>
 
 #include <getopt.h>
@@ -521,17 +523,22 @@ do_copy (int argc, char **argv, const struct cp_options *x)
         where SUFFIX is determined by any version control options used.  */
 
       if (x->force
-         && backup_type != none
+         && x->backup_type != none
          && STREQ (source, dest)
          && !new_dst && S_ISREG (sb.st_mode))
        {
-         new_dest = find_backup_file_name (dest);
-         /* Set backup_type to `none' so that the normal backup
+         static struct cp_options x_tmp;
+
+         new_dest = find_backup_file_name (dest, x->backup_type);
+         /* Set x->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;
+         x_tmp = *x;
+         x_tmp.backup_type = none;
+         x = &x_tmp;
+
          if (new_dest == NULL)
            error (1, 0, _("virtual memory exhausted"));
        }
@@ -743,8 +750,7 @@ main (int argc, char **argv)
       usage (1);
     }
 
-  if (make_backups)
-    backup_type = get_version (version);
+  x.backup_type = (make_backups ? get_version (version) : none);
 
   if (x.preserve == 1)
     x.umask_kill = 0777777;