Remove entries from the accept list as they are matched so we can determine if any files that were specified in the list wernt found.
This commit is contained in:
parent
98f824aa22
commit
25bca9566d
@ -6,10 +6,18 @@
|
|||||||
*/
|
*/
|
||||||
extern char filter_accept_list(const llist_t *accept_list, const llist_t *reject_list, const char *key)
|
extern char filter_accept_list(const llist_t *accept_list, const llist_t *reject_list, const char *key)
|
||||||
{
|
{
|
||||||
|
llist_t *accept_old;
|
||||||
|
|
||||||
while (accept_list) {
|
while (accept_list) {
|
||||||
if (fnmatch(accept_list->data, key, 0) == 0) {
|
if (fnmatch(accept_list->data, key, 0) == 0) {
|
||||||
|
/* Remove entry from list */
|
||||||
|
accept_old->link = accept_list->link;
|
||||||
|
free(accept_list->data);
|
||||||
|
free(accept_list);
|
||||||
|
accept_list = accept_old;
|
||||||
return(EXIT_SUCCESS);
|
return(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
accept_old = accept_list;
|
||||||
accept_list = accept_list->link;
|
accept_list = accept_list->link;
|
||||||
}
|
}
|
||||||
return(EXIT_FAILURE);
|
return(EXIT_FAILURE);
|
||||||
|
@ -717,6 +717,7 @@ int tar_main(int argc, char **argv)
|
|||||||
|
|
||||||
#ifdef CONFIG_FEATURE_TAR_EXCLUDE
|
#ifdef CONFIG_FEATURE_TAR_EXCLUDE
|
||||||
if (tar_handle->reject) {
|
if (tar_handle->reject) {
|
||||||
|
printf("Reject list\n");
|
||||||
tar_handle->filter = filter_accept_reject_list;
|
tar_handle->filter = filter_accept_reject_list;
|
||||||
} else
|
} else
|
||||||
#endif /* CONFIG_FEATURE_TAR_EXCLUDE */
|
#endif /* CONFIG_FEATURE_TAR_EXCLUDE */
|
||||||
@ -762,6 +763,11 @@ int tar_main(int argc, char **argv)
|
|||||||
while (get_header_tar(tar_handle) == EXIT_SUCCESS);
|
while (get_header_tar(tar_handle) == EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Skip through list */
|
||||||
|
while (tar_handle->accept) {
|
||||||
|
error_msg_and_die("%s: Not found in archive\n", tar_handle->accept->data);
|
||||||
|
tar_handle->accept = tar_handle->accept->link;
|
||||||
|
}
|
||||||
#ifdef CONFIG_FEATURE_CLEAN_UP
|
#ifdef CONFIG_FEATURE_CLEAN_UP
|
||||||
if (tar_handle->src_fd != fileno(stdin)) {
|
if (tar_handle->src_fd != fileno(stdin)) {
|
||||||
close(tar_handle->src_fd);
|
close(tar_handle->src_fd);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user