summaryrefslogtreecommitdiff
path: root/libbb/copy_file.c
diff options
context:
space:
mode:
authorGlenn L McGrath2004-01-11 05:20:59 +0000
committerGlenn L McGrath2004-01-11 05:20:59 +0000
commit447bc2d17f3abfac1f0f1a801d01641aada7027c (patch)
treedcb550f74334dbc1ecd04f39d132c56391977375 /libbb/copy_file.c
parent716ccb263569560777f7ff31581e1242d1cb33aa (diff)
downloadbusybox-447bc2d17f3abfac1f0f1a801d01641aada7027c.zip
busybox-447bc2d17f3abfac1f0f1a801d01641aada7027c.tar.gz
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
Diffstat (limited to 'libbb/copy_file.c')
-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 ffdb824..7ddb9a2 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)
}
}
- dst_fd = open(dest, O_WRONLY);
+ dst_fd = open(dest, O_WRONLY|O_TRUNC);
if (dst_fd == -1) {
if (!(flags & FILEUTILS_FORCE)) {
bb_perror_msg("unable to open `%s'", dest);