summaryrefslogtreecommitdiff
path: root/src/copy.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2001-08-06 17:29:15 +0000
committerJim Meyering <jim@meyering.net>2001-08-06 17:29:15 +0000
commit01f160092e3a67c6a87019d034ba5294279b14ae (patch)
treead2612907ecdea96b27bb2af347716614d6f19e4 /src/copy.c
parent053a9d88ee50c66f3e4f02bd892ab583bcb13a22 (diff)
downloadcoreutils-01f160092e3a67c6a87019d034ba5294279b14ae.tar.xz
(copy_internal): Set *rename_succeeded, so that
the caller (mv) doesn't remove the source file.
Diffstat (limited to 'src/copy.c')
-rw-r--r--src/copy.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/copy.c b/src/copy.c
index bc4b41065..1096fba23 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -653,7 +653,13 @@ copy_internal (const char *src_path, const char *dst_path,
}
if (x->update && MTIME_CMP (src_sb, dst_sb) <= 0)
- return 0;
+ {
+ /* Pretend the rename succeeded, so the caller (mv)
+ doesn't end up removing the source file. */
+ if (rename_succeeded)
+ *rename_succeeded = 1;
+ return 0;
+ }
}
if (!S_ISDIR (src_type) && x->interactive)