summaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-08-02 19:58:13 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2021-08-02 19:58:13 +0200
commit3d40dfabe1049ecfbe05570b2287cfc5dbd33456 (patch)
tree47a1c8a49e82492b0651de3017d8fa027fb159bb /archival
parent37460f5daff9b9ed751ce37b912cc61de94adf09 (diff)
downloadbusybox-3d40dfabe1049ecfbe05570b2287cfc5dbd33456.tar.gz
tar: simplify addition of --exclude=GLOB to the expansion of -X EXCLFILE
function old new delta tar_main 1115 1105 -10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival')
-rw-r--r--archival/tar.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/archival/tar.c b/archival/tar.c
index 4a540b77a..879f6bf6f 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -1132,14 +1132,15 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
tar_handle->ah_flags &= ~ARCHIVE_RESTORE_DATE;
#if ENABLE_FEATURE_TAR_FROM
+ /* Convert each -X EXCLFILE to list of to-be-rejected glob patterns */
tar_handle->reject = append_file_list_to_list(tar_handle->reject);
# if ENABLE_FEATURE_TAR_LONG_OPTIONS
- /* Append excludes to reject */
- while (excludes) {
- llist_t *next = excludes->link;
- excludes->link = tar_handle->reject;
- tar_handle->reject = excludes;
- excludes = next;
+ /* Append --exclude=GLOBPATTERNs to reject */
+ if (excludes) {
+ llist_t **p2next = &tar_handle->reject;
+ while (*p2next)
+ p2next = &((*p2next)->link);
+ *p2next = excludes;
}
# endif
tar_handle->accept = append_file_list_to_list(tar_handle->accept);