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/filter_accept_reject_list.c | |
parent | 05fa661123d90b990c146ef6d79da82d798ccd6f (diff) | |
download | busybox-c5c1a8a112ebae29862a902e6e511b392c59da74.tar.gz |
Fix exclude/include problem
Diffstat (limited to 'archival/libunarchive/filter_accept_reject_list.c')
-rw-r--r-- | archival/libunarchive/filter_accept_reject_list.c | 21 |
1 files changed, 6 insertions, 15 deletions
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 @@ #include <stdlib.h> #include "unarchive.h" -static char check_list(const llist_t *list, const char *filename) -{ - if (list) { - while (list) { - if (fnmatch(list->data, filename, 0) == 0) { - return(EXIT_SUCCESS); - } - list = list->link; - } - } - return(EXIT_FAILURE); -} - /* * Accept names that are in the accept list */ extern char filter_accept_reject_list(const llist_t *accept_list, const llist_t *reject_list, const char *key) { + const llist_t *accept_entry = find_list_entry(accept_list, key); + const llist_t *reject_entry = find_list_entry(reject_list, key); + /* Fail if an accept list was specified and the key wasnt in there */ - if ((accept_list) && (check_list(accept_list, key) == EXIT_FAILURE)) { + if (accept_list && (accept_entry == NULL)) { return(EXIT_FAILURE); } /* If the key is in a reject list fail */ - if (check_list(reject_list, key) == EXIT_FAILURE) { + if (reject_entry) { return(EXIT_FAILURE); } + /* Accepted */ return(EXIT_SUCCESS); } |