summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley2006-08-04 17:26:58 +0000
committerRob Landley2006-08-04 17:26:58 +0000
commitdaf58ef61a5f78fa54958c0f7a53d13d792e0bb9 (patch)
treee58a1411f75153b2a22621bfe940b1d0b277e17f
parent2c55fcac0875304db50c360300821d1bcffbab03 (diff)
downloadbusybox-daf58ef61a5f78fa54958c0f7a53d13d792e0bb9.zip
busybox-daf58ef61a5f78fa54958c0f7a53d13d792e0bb9.tar.gz
Use xopen3() instead of an after-the-fact chown.
-rw-r--r--archival/libunarchive/data_extract_all.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/archival/libunarchive/data_extract_all.c b/archival/libunarchive/data_extract_all.c
index 5d1ec30..c8d162b 100644
--- a/archival/libunarchive/data_extract_all.c
+++ b/archival/libunarchive/data_extract_all.c
@@ -58,7 +58,8 @@ void data_extract_all(archive_handle_t *archive_handle)
switch(file_header->mode & S_IFMT) {
case S_IFREG: {
/* Regular file */
- dst_fd = xopen(file_header->name, O_WRONLY | O_CREAT | O_EXCL);
+ dst_fd = xopen3(file_header->name, O_WRONLY | O_CREAT | O_EXCL,
+ file_header->mode);
bb_copyfd_size(archive_handle->src_fd, dst_fd, file_header->size);
close(dst_fd);
break;
@@ -93,11 +94,6 @@ void data_extract_all(archive_handle_t *archive_handle)
if (!(archive_handle->flags & ARCHIVE_NOPRESERVE_OWN)) {
lchown(file_header->name, file_header->uid, file_header->gid);
}
- if (!(archive_handle->flags & ARCHIVE_NOPRESERVE_PERM) &&
- (file_header->mode & S_IFMT) != S_IFLNK)
- {
- chmod(file_header->name, file_header->mode);
- }
if (archive_handle->flags & ARCHIVE_PRESERVE_DATE) {
struct utimbuf t;