summaryrefslogtreecommitdiff
path: root/archival/libunarchive/data_extract_all.c
diff options
context:
space:
mode:
authorGlenn L McGrath2002-12-04 22:26:30 +0000
committerGlenn L McGrath2002-12-04 22:26:30 +0000
commit6f9b45b9eff22c664b93ace82d20669340a762f8 (patch)
tree09c96027e71cf06dcaa70859c4b6c39f70b1d459 /archival/libunarchive/data_extract_all.c
parent350d26bbbb127284cefb877b8380049e65665b15 (diff)
downloadbusybox-6f9b45b9eff22c664b93ace82d20669340a762f8.zip
busybox-6f9b45b9eff22c664b93ace82d20669340a762f8.tar.gz
Unlink before mkdir, mknod, symlink to overwrite
Diffstat (limited to 'archival/libunarchive/data_extract_all.c')
-rw-r--r--archival/libunarchive/data_extract_all.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/archival/libunarchive/data_extract_all.c b/archival/libunarchive/data_extract_all.c
index dda5147..7ab87e7 100644
--- a/archival/libunarchive/data_extract_all.c
+++ b/archival/libunarchive/data_extract_all.c
@@ -60,6 +60,7 @@ extern void data_extract_all(archive_handle_t *archive_handle)
break;
}
case S_IFDIR:
+ unlink(file_header->name);
res = mkdir(file_header->name, file_header->mode);
if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
perror_msg("extract_archive: %s", file_header->name);
@@ -67,6 +68,7 @@ extern void data_extract_all(archive_handle_t *archive_handle)
break;
case S_IFLNK:
/* Symlink */
+ unlink(file_header->name);
res = symlink(file_header->link_name, file_header->name);
if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
perror_msg("Cannot create symlink from %s to '%s'", file_header->name, file_header->link_name);
@@ -76,6 +78,7 @@ extern void data_extract_all(archive_handle_t *archive_handle)
case S_IFBLK:
case S_IFCHR:
case S_IFIFO:
+ unlink(file_header->name);
res = mknod(file_header->name, file_header->mode, file_header->device);
if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
perror_msg("Cannot create node %s", file_header->name);