summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko2021-06-22 15:28:34 +0200
committerDenys Vlasenko2021-06-22 15:28:34 +0200
commit56bbbfae7df48f778362d1848d2a4afd2c293d76 (patch)
treeb0ad2dff6ec225e2f41383f870f2f55d47911dd8 /libbb
parent91b9549a8c739e5f0061dffb292d0dedbe913892 (diff)
downloadbusybox-56bbbfae7df48f778362d1848d2a4afd2c293d76.zip
busybox-56bbbfae7df48f778362d1848d2a4afd2c293d76.tar.gz
cp: implement -n
function old new delta .rodata 103681 103722 +41 packed_usage 33698 33717 +19 copy_file 1678 1696 +18 cp_main 500 492 -8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 78/-8) Total: 70 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/copy_file.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libbb/copy_file.c b/libbb/copy_file.c
index 49d1ec9..044bc3c 100644
--- a/libbb/copy_file.c
+++ b/libbb/copy_file.c
@@ -111,6 +111,8 @@ int FAST_FUNC copy_file(const char *source, const char *dest, int flags)
bb_error_msg("'%s' and '%s' are the same file", source, dest);
return -1;
}
+ if (flags & FILEUTILS_NO_OVERWRITE) /* cp -n */
+ return 0;
dest_exists = 1;
}