unlink a previous file before its extracted
authorGlenn L McGrath <bug1@ihug.co.nz>
Mon, 21 Apr 2003 11:03:29 +0000 (11:03 -0000)
committerGlenn L McGrath <bug1@ihug.co.nz>
Mon, 21 Apr 2003 11:03:29 +0000 (11:03 -0000)
archival/libunarchive/data_extract_all.c

index 77b4de593edda5f235663d43c13c5ff87725768e..bd264dd749884d518d9f92c62b601a54cdb46f13 100644 (file)
@@ -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);
                        }