diff options
author | Jim Meyering <jim@meyering.net> | 1998-01-22 08:19:17 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1998-01-22 08:19:17 +0000 |
commit | 6cce6a1b7f4905a975270b6ac257ea20b276ddae (patch) | |
tree | 0db2211ae0028bc5ce66fff104d9befdb39debaf | |
parent | d9f0ca41bd4b36c773a42786990bf7514a46413c (diff) | |
download | coreutils-6cce6a1b7f4905a975270b6ac257ea20b276ddae.tar.xz |
[NDEBUG]: Comment out definition.
(do_copy): Use x->backup_type, not the global.
-rw-r--r-- | src/cp.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -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; |