aboutsummaryrefslogtreecommitdiff
path: root/archival/unzip.c
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-10-08 12:49:22 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-10-08 12:49:22 +0000
commit87d25a2b8535dc627a02eb539fa3946be2a24647 (patch)
treefc4d14a910593d1235318bb36abe5e9f72d2039e /archival/unzip.c
parent81177b14907e73f11560f69e0b4ec34371f1a7d5 (diff)
downloadbusybox-w32-87d25a2b8535dc627a02eb539fa3946be2a24647.tar.gz
busybox-w32-87d25a2b8535dc627a02eb539fa3946be2a24647.tar.bz2
busybox-w32-87d25a2b8535dc627a02eb539fa3946be2a24647.zip
attempt to regularize atoi mess.
git-svn-id: svn://busybox.net/trunk/busybox@16342 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'archival/unzip.c')
-rw-r--r--archival/unzip.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/archival/unzip.c b/archival/unzip.c
index f63925739..f70baebf9 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -51,11 +51,12 @@ typedef union {
51 } formatted ATTRIBUTE_PACKED; 51 } formatted ATTRIBUTE_PACKED;
52} zip_header_t; 52} zip_header_t;
53 53
54/* This one never works with LARGEFILE-sized skips */
54static void unzip_skip(int fd, off_t skip) 55static void unzip_skip(int fd, off_t skip)
55{ 56{
56 if (lseek(fd, skip, SEEK_CUR) == (off_t)-1) { 57 if (lseek(fd, skip, SEEK_CUR) == (off_t)-1) {
57 if ((errno != ESPIPE) || (bb_copyfd_size(fd, -1, skip) != skip)) { 58 if ((errno != ESPIPE) || (bb_copyfd_size(fd, -1, skip) != skip)) {
58 bb_error_msg_and_die("Seek failure"); 59 bb_error_msg_and_die("seek failure");
59 } 60 }
60 } 61 }
61} 62}
@@ -65,7 +66,7 @@ static void unzip_create_leading_dirs(char *fn)
65 /* Create all leading directories */ 66 /* Create all leading directories */
66 char *name = xstrdup(fn); 67 char *name = xstrdup(fn);
67 if (bb_make_directory(dirname(name), 0777, FILEUTILS_RECUR)) { 68 if (bb_make_directory(dirname(name), 0777, FILEUTILS_RECUR)) {
68 bb_error_msg_and_die("Exiting"); /* bb_make_directory is noisy */ 69 bb_error_msg_and_die("exiting"); /* bb_make_directory is noisy */
69 } 70 }
70 free(name); 71 free(name);
71} 72}
@@ -76,7 +77,7 @@ static int unzip_extract(zip_header_t *zip_header, int src_fd, int dst_fd)
76 /* Method 0 - stored (not compressed) */ 77 /* Method 0 - stored (not compressed) */
77 int size = zip_header->formatted.ucmpsize; 78 int size = zip_header->formatted.ucmpsize;
78 if (size && (bb_copyfd_size(src_fd, dst_fd, size) != size)) { 79 if (size && (bb_copyfd_size(src_fd, dst_fd, size) != size)) {
79 bb_error_msg_and_die("Cannot complete extraction"); 80 bb_error_msg_and_die("cannot complete extraction");
80 } 81 }
81 82
82 } else { 83 } else {
@@ -86,12 +87,12 @@ static int unzip_extract(zip_header_t *zip_header, int src_fd, int dst_fd)
86 inflate_cleanup(); 87 inflate_cleanup();
87 /* Validate decompression - crc */ 88 /* Validate decompression - crc */
88 if (zip_header->formatted.crc32 != (gunzip_crc ^ 0xffffffffL)) { 89 if (zip_header->formatted.crc32 != (gunzip_crc ^ 0xffffffffL)) {
89 bb_error_msg("Invalid compressed data--crc error"); 90 bb_error_msg("invalid compressed data--%s error", "crc");
90 return 1; 91 return 1;
91 } 92 }
92 /* Validate decompression - size */ 93 /* Validate decompression - size */
93 if (zip_header->formatted.ucmpsize != gunzip_bytes_out) { 94 if (zip_header->formatted.ucmpsize != gunzip_bytes_out) {
94 bb_error_msg("Invalid compressed data--length error"); 95 bb_error_msg("invalid compressed data--%s error", "length");
95 return 1; 96 return 1;
96 } 97 }
97 } 98 }