diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2002-10-19 06:19:22 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2002-10-19 06:19:22 +0000 |
commit | c5c1a8a112ebae29862a902e6e511b392c59da74 (patch) | |
tree | 88df433818b25262966b84fa81aecde8b75c8ed1 /archival/libunarchive | |
parent | 05fa661123d90b990c146ef6d79da82d798ccd6f (diff) | |
download | busybox-w32-c5c1a8a112ebae29862a902e6e511b392c59da74.tar.gz busybox-w32-c5c1a8a112ebae29862a902e6e511b392c59da74.tar.bz2 busybox-w32-c5c1a8a112ebae29862a902e6e511b392c59da74.zip |
Fix exclude/include problem
Diffstat (limited to 'archival/libunarchive')
-rw-r--r-- | archival/libunarchive/Makefile.in | 1 | ||||
-rw-r--r-- | archival/libunarchive/filter_accept_list.c | 19 | ||||
-rw-r--r-- | archival/libunarchive/filter_accept_reject_list.c | 21 | ||||
-rw-r--r-- | archival/libunarchive/get_header_tar.c | 7 |
4 files changed, 19 insertions, 29 deletions
diff --git a/archival/libunarchive/Makefile.in b/archival/libunarchive/Makefile.in index e2ac546ab..e559cb40e 100644 --- a/archival/libunarchive/Makefile.in +++ b/archival/libunarchive/Makefile.in | |||
@@ -48,6 +48,7 @@ LIBUNARCHIVE-y:= \ | |||
48 | init_handle.o \ | 48 | init_handle.o \ |
49 | seek_sub_file.o \ | 49 | seek_sub_file.o \ |
50 | unpack_ar_archive.o \ | 50 | unpack_ar_archive.o \ |
51 | find_list_entry.o | ||
51 | 52 | ||
52 | LIBUNARCHIVE-$(CONFIG_DPKG) += | 53 | LIBUNARCHIVE-$(CONFIG_DPKG) += |
53 | LIBUNARCHIVE-$(CONFIG_DPKG_DEB) += | 54 | LIBUNARCHIVE-$(CONFIG_DPKG_DEB) += |
diff --git a/archival/libunarchive/filter_accept_list.c b/archival/libunarchive/filter_accept_list.c index 9f92e6440..2b023ec70 100644 --- a/archival/libunarchive/filter_accept_list.c +++ b/archival/libunarchive/filter_accept_list.c | |||
@@ -1,24 +1,15 @@ | |||
1 | #include <fnmatch.h> | 1 | #include <fnmatch.h> |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include "unarchive.h" | 3 | #include "unarchive.h" |
4 | |||
4 | /* | 5 | /* |
5 | * Accept names that are in the accept list | 6 | * Accept names that are in the accept list |
6 | */ | 7 | */ |
7 | extern char filter_accept_list(const llist_t *accept_list, const llist_t *reject_list, const char *key) | 8 | extern char filter_accept_list(const llist_t *accept_list, const llist_t *reject_list, const char *key) |
8 | { | 9 | { |
9 | llist_t *accept_old; | 10 | if (find_list_entry(accept_list, key)) { |
10 | 11 | return(EXIT_SUCCESS); | |
11 | while (accept_list) { | 12 | } else { |
12 | if (fnmatch(accept_list->data, key, 0) == 0) { | 13 | return(EXIT_FAILURE); |
13 | /* Remove entry from list */ | ||
14 | accept_old->link = accept_list->link; | ||
15 | free(accept_list->data); | ||
16 | free(accept_list); | ||
17 | accept_list = accept_old; | ||
18 | return(EXIT_SUCCESS); | ||
19 | } | ||
20 | accept_old = accept_list; | ||
21 | accept_list = accept_list->link; | ||
22 | } | 14 | } |
23 | return(EXIT_FAILURE); | ||
24 | } | 15 | } |
diff --git a/archival/libunarchive/filter_accept_reject_list.c b/archival/libunarchive/filter_accept_reject_list.c index c893dfcfc..21fecf120 100644 --- a/archival/libunarchive/filter_accept_reject_list.c +++ b/archival/libunarchive/filter_accept_reject_list.c | |||
@@ -2,33 +2,24 @@ | |||
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include "unarchive.h" | 3 | #include "unarchive.h" |
4 | 4 | ||
5 | static char check_list(const llist_t *list, const char *filename) | ||
6 | { | ||
7 | if (list) { | ||
8 | while (list) { | ||
9 | if (fnmatch(list->data, filename, 0) == 0) { | ||
10 | return(EXIT_SUCCESS); | ||
11 | } | ||
12 | list = list->link; | ||
13 | } | ||
14 | } | ||
15 | return(EXIT_FAILURE); | ||
16 | } | ||
17 | |||
18 | /* | 5 | /* |
19 | * Accept names that are in the accept list | 6 | * Accept names that are in the accept list |
20 | */ | 7 | */ |
21 | extern char filter_accept_reject_list(const llist_t *accept_list, const llist_t *reject_list, const char *key) | 8 | extern char filter_accept_reject_list(const llist_t *accept_list, const llist_t *reject_list, const char *key) |
22 | { | 9 | { |
10 | const llist_t *accept_entry = find_list_entry(accept_list, key); | ||
11 | const llist_t *reject_entry = find_list_entry(reject_list, key); | ||
12 | |||
23 | /* Fail if an accept list was specified and the key wasnt in there */ | 13 | /* Fail if an accept list was specified and the key wasnt in there */ |
24 | if ((accept_list) && (check_list(accept_list, key) == EXIT_FAILURE)) { | 14 | if (accept_list && (accept_entry == NULL)) { |
25 | return(EXIT_FAILURE); | 15 | return(EXIT_FAILURE); |
26 | } | 16 | } |
27 | 17 | ||
28 | /* If the key is in a reject list fail */ | 18 | /* If the key is in a reject list fail */ |
29 | if (check_list(reject_list, key) == EXIT_FAILURE) { | 19 | if (reject_entry) { |
30 | return(EXIT_FAILURE); | 20 | return(EXIT_FAILURE); |
31 | } | 21 | } |
32 | 22 | ||
23 | /* Accepted */ | ||
33 | return(EXIT_SUCCESS); | 24 | return(EXIT_SUCCESS); |
34 | } | 25 | } |
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c index bb0affeb3..e87eb77b8 100644 --- a/archival/libunarchive/get_header_tar.c +++ b/archival/libunarchive/get_header_tar.c | |||
@@ -47,6 +47,7 @@ extern char get_header_tar(archive_handle_t *archive_handle) | |||
47 | } tar; | 47 | } tar; |
48 | long sum = 0; | 48 | long sum = 0; |
49 | long i; | 49 | long i; |
50 | char *tmp; | ||
50 | 51 | ||
51 | /* Align header */ | 52 | /* Align header */ |
52 | archive_handle->offset += data_align(archive_handle->src_fd, archive_handle->offset, 512); | 53 | archive_handle->offset += data_align(archive_handle->src_fd, archive_handle->offset, 512); |
@@ -91,6 +92,11 @@ extern char get_header_tar(archive_handle_t *archive_handle) | |||
91 | } else { | 92 | } else { |
92 | file_header->name = concat_path_file(tar.formated.prefix, tar.formated.name); | 93 | file_header->name = concat_path_file(tar.formated.prefix, tar.formated.name); |
93 | } | 94 | } |
95 | tmp = last_char_is(archive_handle->file_header->name, '/'); | ||
96 | if (tmp) { | ||
97 | *tmp = '\0'; | ||
98 | } | ||
99 | |||
94 | file_header->mode = strtol(tar.formated.mode, NULL, 8); | 100 | file_header->mode = strtol(tar.formated.mode, NULL, 8); |
95 | file_header->uid = strtol(tar.formated.uid, NULL, 8); | 101 | file_header->uid = strtol(tar.formated.uid, NULL, 8); |
96 | file_header->gid = strtol(tar.formated.gid, NULL, 8); | 102 | file_header->gid = strtol(tar.formated.gid, NULL, 8); |
@@ -159,6 +165,7 @@ extern char get_header_tar(archive_handle_t *archive_handle) | |||
159 | archive_handle->action_header(archive_handle->file_header); | 165 | archive_handle->action_header(archive_handle->file_header); |
160 | archive_handle->flags |= ARCHIVE_EXTRACT_QUIET; | 166 | archive_handle->flags |= ARCHIVE_EXTRACT_QUIET; |
161 | archive_handle->action_data(archive_handle); | 167 | archive_handle->action_data(archive_handle); |
168 | archive_handle->passed = add_to_list(archive_handle->passed, archive_handle->file_header->name); | ||
162 | } else { | 169 | } else { |
163 | data_skip(archive_handle); | 170 | data_skip(archive_handle); |
164 | } | 171 | } |