summaryrefslogtreecommitdiff
path: root/archival/libunarchive/data_extract_all.c
diff options
context:
space:
mode:
authorGlenn L McGrath2003-04-21 11:03:29 +0000
committerGlenn L McGrath2003-04-21 11:03:29 +0000
commitafc01cd48544d4e0e7575a8518e575dd499e297c (patch)
treee9dc971328bb6099ec294fd83a7c703c653622d4 /archival/libunarchive/data_extract_all.c
parent923dd79af708182743a790e47146253e6d272702 (diff)
downloadbusybox-afc01cd48544d4e0e7575a8518e575dd499e297c.zip
busybox-afc01cd48544d4e0e7575a8518e575dd499e297c.tar.gz
unlink a previous file before its extracted
Diffstat (limited to 'archival/libunarchive/data_extract_all.c')
-rw-r--r--archival/libunarchive/data_extract_all.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/archival/libunarchive/data_extract_all.c b/archival/libunarchive/data_extract_all.c
index 77b4de5..bd264dd 100644
--- a/archival/libunarchive/data_extract_all.c
+++ b/archival/libunarchive/data_extract_all.c
@@ -53,7 +53,8 @@ extern void data_extract_all(archive_handle_t *archive_handle)
#endif
{
/* Regular file */
- dst_fd = bb_xopen(file_header->name, O_WRONLY | O_CREAT);
+ unlink(file_header->name);
+ dst_fd = bb_xopen(file_header->name, O_WRONLY | O_CREAT | O_EXCL);
archive_copy_file(archive_handle, dst_fd);
close(dst_fd);
}