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/tar.c | |
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/tar.c')
-rw-r--r-- | archival/tar.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/archival/tar.c b/archival/tar.c index df110a149..d8889ae19 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -586,14 +586,10 @@ static inline int writeTarFile(const char *tarName, const int verboseFlag, | |||
586 | static const llist_t *append_file_list_to_list(const char *filename, const llist_t *list) | 586 | static const llist_t *append_file_list_to_list(const char *filename, const llist_t *list) |
587 | { | 587 | { |
588 | FILE *src_stream = xfopen(filename, "r"); | 588 | FILE *src_stream = xfopen(filename, "r"); |
589 | while(1) { | 589 | char *line; |
590 | char *line = get_line_from_file(src_stream); | 590 | while((line = get_line_from_file(src_stream)) != NULL) { |
591 | if (line == NULL) { | ||
592 | break; | ||
593 | } | ||
594 | chomp(line); | 591 | chomp(line); |
595 | list = add_to_list(list, line); | 592 | list = add_to_list(list, line); |
596 | free(line); | ||
597 | } | 593 | } |
598 | fclose(src_stream); | 594 | fclose(src_stream); |
599 | 595 | ||
@@ -715,14 +711,10 @@ int tar_main(int argc, char **argv) | |||
715 | tar_handle->accept = add_to_list(tar_handle->accept, argv[optind]); | 711 | tar_handle->accept = add_to_list(tar_handle->accept, argv[optind]); |
716 | optind++; | 712 | optind++; |
717 | 713 | ||
718 | #ifdef CONFIG_FEATURE_TAR_EXCLUDE | 714 | } |
719 | if (tar_handle->reject) { | ||
720 | printf("Reject list\n"); | ||
721 | tar_handle->filter = filter_accept_reject_list; | ||
722 | } else | ||
723 | #endif /* CONFIG_FEATURE_TAR_EXCLUDE */ | ||
724 | 715 | ||
725 | tar_handle->filter = filter_accept_list; | 716 | if ((tar_handle->accept) || (tar_handle->reject)) { |
717 | tar_handle->filter = filter_accept_reject_list; | ||
726 | } | 718 | } |
727 | 719 | ||
728 | if ((base_dir) && (chdir(base_dir))) { | 720 | if ((base_dir) && (chdir(base_dir))) { |
@@ -761,13 +753,18 @@ int tar_main(int argc, char **argv) | |||
761 | #endif /* CONFIG_FEATURE_TAR_CREATE */ | 753 | #endif /* CONFIG_FEATURE_TAR_CREATE */ |
762 | 754 | ||
763 | while (get_header_tar(tar_handle) == EXIT_SUCCESS); | 755 | while (get_header_tar(tar_handle) == EXIT_SUCCESS); |
764 | } | ||
765 | 756 | ||
766 | /* Skip through list */ | 757 | /* Ckeck that every file that should have been extracted was */ |
767 | while (tar_handle->accept) { | 758 | while (tar_handle->accept) { |
768 | error_msg_and_die("%s: Not found in archive\n", tar_handle->accept->data); | 759 | if (find_list_entry(tar_handle->reject, tar_handle->accept->data) == NULL) { |
769 | tar_handle->accept = tar_handle->accept->link; | 760 | if (find_list_entry(tar_handle->passed, tar_handle->accept->data) == NULL) { |
761 | error_msg_and_die("%s: Not found in archive\n", tar_handle->accept->data); | ||
762 | } | ||
763 | } | ||
764 | tar_handle->accept = tar_handle->accept->link; | ||
765 | } | ||
770 | } | 766 | } |
767 | |||
771 | #ifdef CONFIG_FEATURE_CLEAN_UP | 768 | #ifdef CONFIG_FEATURE_CLEAN_UP |
772 | if (tar_handle->src_fd != fileno(stdin)) { | 769 | if (tar_handle->src_fd != fileno(stdin)) { |
773 | close(tar_handle->src_fd); | 770 | close(tar_handle->src_fd); |