summaryrefslogtreecommitdiff
path: root/busybox/libbb
diff options
context:
space:
mode:
authorRob Landley2005-08-12 06:06:54 +0000
committerRob Landley2005-08-12 06:06:54 +0000
commitd5138f44fe2e496498c62a06b7f50381edf952da (patch)
treeb0c7e721ab4924d93491876f5e859389eb22b039 /busybox/libbb
parent9344d8aa10ecf99aba3eae97e4fa131360f89729 (diff)
downloadbusybox-d5138f44fe2e496498c62a06b7f50381edf952da.zip
busybox-d5138f44fe2e496498c62a06b7f50381edf952da.tar.gz
Backport 10853, 10860/10870, and 10862.
Diffstat (limited to 'busybox/libbb')
-rw-r--r--busybox/libbb/copy_file.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/busybox/libbb/copy_file.c b/busybox/libbb/copy_file.c
index 68a1ded..4b349b7 100644
--- a/busybox/libbb/copy_file.c
+++ b/busybox/libbb/copy_file.c
@@ -197,12 +197,16 @@ int copy_file(const char *source, const char *dest, int flags)
S_ISSOCK(source_stat.st_mode) || S_ISFIFO(source_stat.st_mode) ||
S_ISLNK(source_stat.st_mode)) {
- if (dest_exists &&
- ((flags & FILEUTILS_FORCE) == 0 || unlink(dest) < 0)) {
+ if (dest_exists) {
+ if((flags & FILEUTILS_FORCE) == 0) {
+ fprintf(stderr, "`%s' exists\n", dest);
+ return -1;
+ }
+ if(unlink(dest) < 0) {
bb_perror_msg("unable to remove `%s'", dest);
return -1;
-
}
+ }
} else {
bb_error_msg("internal error: unrecognized file type");
return -1;