diff options
author | Rob Landley <rob@landley.net> | 2006-08-04 17:26:58 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-08-04 17:26:58 +0000 |
commit | daf58ef61a5f78fa54958c0f7a53d13d792e0bb9 (patch) | |
tree | e58a1411f75153b2a22621bfe940b1d0b277e17f | |
parent | 2c55fcac0875304db50c360300821d1bcffbab03 (diff) | |
download | busybox-w32-daf58ef61a5f78fa54958c0f7a53d13d792e0bb9.tar.gz busybox-w32-daf58ef61a5f78fa54958c0f7a53d13d792e0bb9.tar.bz2 busybox-w32-daf58ef61a5f78fa54958c0f7a53d13d792e0bb9.zip |
Use xopen3() instead of an after-the-fact chown.
-rw-r--r-- | archival/libunarchive/data_extract_all.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/archival/libunarchive/data_extract_all.c b/archival/libunarchive/data_extract_all.c index 5d1ec302a..c8d162bce 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) | |||
58 | switch(file_header->mode & S_IFMT) { | 58 | switch(file_header->mode & S_IFMT) { |
59 | case S_IFREG: { | 59 | case S_IFREG: { |
60 | /* Regular file */ | 60 | /* Regular file */ |
61 | dst_fd = xopen(file_header->name, O_WRONLY | O_CREAT | O_EXCL); | 61 | dst_fd = xopen3(file_header->name, O_WRONLY | O_CREAT | O_EXCL, |
62 | file_header->mode); | ||
62 | bb_copyfd_size(archive_handle->src_fd, dst_fd, file_header->size); | 63 | bb_copyfd_size(archive_handle->src_fd, dst_fd, file_header->size); |
63 | close(dst_fd); | 64 | close(dst_fd); |
64 | break; | 65 | break; |
@@ -93,11 +94,6 @@ void data_extract_all(archive_handle_t *archive_handle) | |||
93 | if (!(archive_handle->flags & ARCHIVE_NOPRESERVE_OWN)) { | 94 | if (!(archive_handle->flags & ARCHIVE_NOPRESERVE_OWN)) { |
94 | lchown(file_header->name, file_header->uid, file_header->gid); | 95 | lchown(file_header->name, file_header->uid, file_header->gid); |
95 | } | 96 | } |
96 | if (!(archive_handle->flags & ARCHIVE_NOPRESERVE_PERM) && | ||
97 | (file_header->mode & S_IFMT) != S_IFLNK) | ||
98 | { | ||
99 | chmod(file_header->name, file_header->mode); | ||
100 | } | ||
101 | 97 | ||
102 | if (archive_handle->flags & ARCHIVE_PRESERVE_DATE) { | 98 | if (archive_handle->flags & ARCHIVE_PRESERVE_DATE) { |
103 | struct utimbuf t; | 99 | struct utimbuf t; |