aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorbug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-01-11 05:20:59 +0000
committerbug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-01-11 05:20:59 +0000
commitdaad13f169c3ecb6ac15313509acb16c230ffdab (patch)
treedcb550f74334dbc1ecd04f39d132c56391977375 /libbb
parentab04b6bcc6b42137a0af8098e9248b4590a6385a (diff)
downloadbusybox-w32-daad13f169c3ecb6ac15313509acb16c230ffdab.tar.gz
busybox-w32-daad13f169c3ecb6ac15313509acb16c230ffdab.tar.bz2
busybox-w32-daad13f169c3ecb6ac15313509acb16c230ffdab.zip
Patch from Matt Kraai to fix debian bug #227081
cp does not truncate existing destinations. That is, after running echo foo > foo echo fubar > fubar cp foo fubar the contents of fubar are foo r instead of foo git-svn-id: svn://busybox.net/trunk/busybox@8270 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'libbb')
-rw-r--r--libbb/copy_file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libbb/copy_file.c b/libbb/copy_file.c
index ffdb8242b..7ddb9a23f 100644
--- a/libbb/copy_file.c
+++ b/libbb/copy_file.c
@@ -153,7 +153,7 @@ int copy_file(const char *source, const char *dest, int flags)
153 } 153 }
154 } 154 }
155 155
156 dst_fd = open(dest, O_WRONLY); 156 dst_fd = open(dest, O_WRONLY|O_TRUNC);
157 if (dst_fd == -1) { 157 if (dst_fd == -1) {
158 if (!(flags & FILEUTILS_FORCE)) { 158 if (!(flags & FILEUTILS_FORCE)) {
159 bb_perror_msg("unable to open `%s'", dest); 159 bb_perror_msg("unable to open `%s'", dest);