aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbb/copy_file.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libbb/copy_file.c b/libbb/copy_file.c
index 0763b4586..35352d27a 100644
--- a/libbb/copy_file.c
+++ b/libbb/copy_file.c
@@ -165,11 +165,10 @@ int copy_file(const char *source, const char *dest, int flags)
165 return -1; 165 return -1;
166 } 166 }
167 167
168 dest_exists = 0; 168 goto dest_removed;
169 } 169 }
170 } 170 } else {
171 171dest_removed:
172 if (!dest_exists) {
173 dst_fd = open(dest, O_WRONLY|O_CREAT, source_stat.st_mode); 172 dst_fd = open(dest, O_WRONLY|O_CREAT, source_stat.st_mode);
174 if (dst_fd == -1) { 173 if (dst_fd == -1) {
175 bb_perror_msg("unable to open `%s'", dest); 174 bb_perror_msg("unable to open `%s'", dest);