aboutsummaryrefslogtreecommitdiff
path: root/archival/unzip.c
diff options
context:
space:
mode:
Diffstat (limited to 'archival/unzip.c')
-rw-r--r--archival/unzip.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/archival/unzip.c b/archival/unzip.c
index 86416d327..f2d7f4918 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -120,12 +120,12 @@ extern int unzip_main(int argc, char **argv)
120 break; 120 break;
121#endif 121#endif
122 default: 122 default:
123 show_usage(); 123 bb_show_usage();
124 } 124 }
125 } 125 }
126 126
127 if (argc == optind) { 127 if (argc == optind) {
128 show_usage(); 128 bb_show_usage();
129 } 129 }
130 130
131 printf("Archive: %s\n", argv[optind]); 131 printf("Archive: %s\n", argv[optind]);
@@ -138,11 +138,11 @@ extern int unzip_main(int argc, char **argv)
138 archive_handle->src_fd = fileno(stdin); 138 archive_handle->src_fd = fileno(stdin);
139 archive_handle->seek = seek_by_char; 139 archive_handle->seek = seek_by_char;
140 } else { 140 } else {
141 archive_handle->src_fd = xopen(argv[optind++], O_RDONLY); 141 archive_handle->src_fd = bb_xopen(argv[optind++], O_RDONLY);
142 } 142 }
143 143
144 if ((base_dir) && (chdir(base_dir))) { 144 if ((base_dir) && (chdir(base_dir))) {
145 perror_msg_and_die("Couldnt chdir"); 145 bb_perror_msg_and_die("Couldnt chdir");
146 } 146 }
147 147
148 while (optind < argc) { 148 while (optind < argc) {
@@ -163,7 +163,7 @@ extern int unzip_main(int argc, char **argv)
163 break; 163 break;
164 } 164 }
165 else if (magic != ZIP_FILEHEADER_MAGIC) { 165 else if (magic != ZIP_FILEHEADER_MAGIC) {
166 error_msg_and_die("Invlaide zip magic"); 166 bb_error_msg_and_die("Invlaide zip magic");
167 } 167 }
168 168
169 /* Read the file header */ 169 /* Read the file header */
@@ -172,7 +172,7 @@ extern int unzip_main(int argc, char **argv)
172 archive_handle->file_header->mode = S_IFREG | 0777; 172 archive_handle->file_header->mode = S_IFREG | 0777;
173 173
174 if (zip_header.formated.method != 8) { 174 if (zip_header.formated.method != 8) {
175 error_msg_and_die("Unsupported compression method %d\n", zip_header.formated.method); 175 bb_error_msg_and_die("Unsupported compression method %d\n", zip_header.formated.method);
176 } 176 }
177 177
178 /* Read filename */ 178 /* Read filename */
@@ -198,19 +198,19 @@ extern int unzip_main(int argc, char **argv)
198 if (archive_handle->action_data) { 198 if (archive_handle->action_data) {
199 archive_handle->action_data(archive_handle); 199 archive_handle->action_data(archive_handle);
200 } else { 200 } else {
201 dst_fd = xopen(archive_handle->file_header->name, O_WRONLY | O_CREAT); 201 dst_fd = bb_xopen(archive_handle->file_header->name, O_WRONLY | O_CREAT);
202 inflate(archive_handle->src_fd, dst_fd); 202 inflate(archive_handle->src_fd, dst_fd);
203 close(dst_fd); 203 close(dst_fd);
204 chmod(archive_handle->file_header->name, archive_handle->file_header->mode); 204 chmod(archive_handle->file_header->name, archive_handle->file_header->mode);
205 205
206 /* Validate decompression - crc */ 206 /* Validate decompression - crc */
207 if (zip_header.formated.crc32 != (gunzip_crc ^ 0xffffffffL)) { 207 if (zip_header.formated.crc32 != (gunzip_crc ^ 0xffffffffL)) {
208 error_msg("Invalid compressed data--crc error"); 208 bb_error_msg("Invalid compressed data--crc error");
209 } 209 }
210 210
211 /* Validate decompression - size */ 211 /* Validate decompression - size */
212 if (gunzip_bytes_out != zip_header.formated.ucmpsize) { 212 if (gunzip_bytes_out != zip_header.formated.ucmpsize) {
213 error_msg("Invalid compressed data--length error"); 213 bb_error_msg("Invalid compressed data--length error");
214 } 214 }
215 } 215 }
216 216