diff options
author | Glenn L McGrath | 2001-08-04 05:28:29 +0000 |
---|---|---|
committer | Glenn L McGrath | 2001-08-04 05:28:29 +0000 |
commit | b373a8d0ca73acfc042a9741f8e3f803dc1cefa3 (patch) | |
tree | 5dd7d44bc0370b3a16ba795eec181e34290aac20 | |
parent | 0b7d70c822ae473b42a9db95cdc026286d992a48 (diff) | |
download | busybox-b373a8d0ca73acfc042a9741f8e3f803dc1cefa3.zip busybox-b373a8d0ca73acfc042a9741f8e3f803dc1cefa3.tar.gz |
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 91db2e3..0d414a3 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 const int extract_function, const char *prefix, char **extract_names) { file_header_t *file_entry; - int found; + int extract_flag; int i; char *buffer = NULL; archive_offset = 0; while ((file_entry = get_headers(src_stream)) != NULL) { - found = FALSE; - if (extract_names == NULL) { - found = TRUE; - } else { + extract_flag = TRUE; + if (extract_names != NULL) { + int found_flag = FALSE; for(i = 0; extract_names[i] != 0; i++) { if (strcmp(extract_names[i], file_entry->name) == 0) { - found = TRUE; + found_flag = TRUE; + break; + } + } + if (extract_function & extract_exclude_list) { + if (found_flag == TRUE) { + extract_flag = FALSE; + } + } else { + /* If its not found in the include list dont extract it */ + if (found_flag == FALSE) { + extract_flag = FALSE; } } + } - if (found) { + if (extract_flag == TRUE) { buffer = extract_archive(src_stream, out_stream, file_entry, extract_function, prefix); } else { /* seek past the data entry */ |