diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2001-08-04 05:28:29 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2001-08-04 05:28:29 +0000 |
commit | b373a8d0ca73acfc042a9741f8e3f803dc1cefa3 (patch) | |
tree | 5dd7d44bc0370b3a16ba795eec181e34290aac20 | |
parent | 0b7d70c822ae473b42a9db95cdc026286d992a48 (diff) | |
download | busybox-w32-b373a8d0ca73acfc042a9741f8e3f803dc1cefa3.tar.gz busybox-w32-b373a8d0ca73acfc042a9741f8e3f803dc1cefa3.tar.bz2 busybox-w32-b373a8d0ca73acfc042a9741f8e3f803dc1cefa3.zip |
Fix exclude list handling
-rw-r--r-- | libbb/unarchive.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/libbb/unarchive.c b/libbb/unarchive.c index 91db2e3b1..0d414a3a8 100644 --- a/libbb/unarchive.c +++ b/libbb/unarchive.c | |||
@@ -230,24 +230,35 @@ char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_headers | |||
230 | const int extract_function, const char *prefix, char **extract_names) | 230 | const int extract_function, const char *prefix, char **extract_names) |
231 | { | 231 | { |
232 | file_header_t *file_entry; | 232 | file_header_t *file_entry; |
233 | int found; | 233 | int extract_flag; |
234 | int i; | 234 | int i; |
235 | char *buffer = NULL; | 235 | char *buffer = NULL; |
236 | 236 | ||
237 | archive_offset = 0; | 237 | archive_offset = 0; |
238 | while ((file_entry = get_headers(src_stream)) != NULL) { | 238 | while ((file_entry = get_headers(src_stream)) != NULL) { |
239 | found = FALSE; | 239 | extract_flag = TRUE; |
240 | if (extract_names == NULL) { | 240 | if (extract_names != NULL) { |
241 | found = TRUE; | 241 | int found_flag = FALSE; |
242 | } else { | ||
243 | for(i = 0; extract_names[i] != 0; i++) { | 242 | for(i = 0; extract_names[i] != 0; i++) { |
244 | if (strcmp(extract_names[i], file_entry->name) == 0) { | 243 | if (strcmp(extract_names[i], file_entry->name) == 0) { |
245 | found = TRUE; | 244 | found_flag = TRUE; |
245 | break; | ||
246 | } | ||
247 | } | ||
248 | if (extract_function & extract_exclude_list) { | ||
249 | if (found_flag == TRUE) { | ||
250 | extract_flag = FALSE; | ||
251 | } | ||
252 | } else { | ||
253 | /* If its not found in the include list dont extract it */ | ||
254 | if (found_flag == FALSE) { | ||
255 | extract_flag = FALSE; | ||
246 | } | 256 | } |
247 | } | 257 | } |
258 | |||
248 | } | 259 | } |
249 | 260 | ||
250 | if (found) { | 261 | if (extract_flag == TRUE) { |
251 | buffer = extract_archive(src_stream, out_stream, file_entry, extract_function, prefix); | 262 | buffer = extract_archive(src_stream, out_stream, file_entry, extract_function, prefix); |
252 | } else { | 263 | } else { |
253 | /* seek past the data entry */ | 264 | /* seek past the data entry */ |