aboutsummaryrefslogtreecommitdiff
path: root/libbb/copy_file.c
diff options
context:
space:
mode:
authorPaul Fox <pgf@brightstareng.com>2005-07-19 20:47:33 +0000
committerPaul Fox <pgf@brightstareng.com>2005-07-19 20:47:33 +0000
commit0a92bbf349c3a5f67182aca3932a7e29185ab3cf (patch)
treeac6d4c839e1a6af0c9a8949526eef2206d67be03 /libbb/copy_file.c
parent574fee4f99dfe3d5a40f47af1841bf6b66f55b60 (diff)
downloadbusybox-w32-0a92bbf349c3a5f67182aca3932a7e29185ab3cf.tar.gz
busybox-w32-0a92bbf349c3a5f67182aca3932a7e29185ab3cf.tar.bz2
busybox-w32-0a92bbf349c3a5f67182aca3932a7e29185ab3cf.zip
applying fix from:
0000067: cp -p produces misleading error message
Diffstat (limited to 'libbb/copy_file.c')
-rw-r--r--libbb/copy_file.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libbb/copy_file.c b/libbb/copy_file.c
index 0120d0b16..e1b98ed4c 100644
--- a/libbb/copy_file.c
+++ b/libbb/copy_file.c
@@ -198,12 +198,16 @@ int copy_file(const char *source, const char *dest, int flags)
198 S_ISSOCK(source_stat.st_mode) || S_ISFIFO(source_stat.st_mode) || 198 S_ISSOCK(source_stat.st_mode) || S_ISFIFO(source_stat.st_mode) ||
199 S_ISLNK(source_stat.st_mode)) { 199 S_ISLNK(source_stat.st_mode)) {
200 200
201 if (dest_exists && 201 if (dest_exists) {
202 ((flags & FILEUTILS_FORCE) == 0 || unlink(dest) < 0)) { 202 if((flags & FILEUTILS_FORCE) == 0) {
203 fprintf(stderr, "`%s' exists\n", dest);
204 return -1;
205 }
206 if(unlink(dest) < 0) {
203 bb_perror_msg("unable to remove `%s'", dest); 207 bb_perror_msg("unable to remove `%s'", dest);
204 return -1; 208 return -1;
205
206 } 209 }
210 }
207 } else { 211 } else {
208 bb_error_msg("internal error: unrecognized file type"); 212 bb_error_msg("internal error: unrecognized file type");
209 return -1; 213 return -1;