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
This commit is contained in:
parent
716ccb2635
commit
447bc2d17f
@ -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 (dst_fd == -1) {
|
||||||
if (!(flags & FILEUTILS_FORCE)) {
|
if (!(flags & FILEUTILS_FORCE)) {
|
||||||
bb_perror_msg("unable to open `%s'", dest);
|
bb_perror_msg("unable to open `%s'", dest);
|
||||||
|
Loading…
Reference in New Issue
Block a user