diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2021-08-02 19:58:13 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-08-02 19:58:13 +0200 |
commit | 3d40dfabe1049ecfbe05570b2287cfc5dbd33456 (patch) | |
tree | 47a1c8a49e82492b0651de3017d8fa027fb159bb | |
parent | 37460f5daff9b9ed751ce37b912cc61de94adf09 (diff) | |
download | busybox-w32-3d40dfabe1049ecfbe05570b2287cfc5dbd33456.tar.gz busybox-w32-3d40dfabe1049ecfbe05570b2287cfc5dbd33456.tar.bz2 busybox-w32-3d40dfabe1049ecfbe05570b2287cfc5dbd33456.zip |
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>
-rw-r--r-- | archival/tar.c | 13 |
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) | |||
1132 | tar_handle->ah_flags &= ~ARCHIVE_RESTORE_DATE; | 1132 | tar_handle->ah_flags &= ~ARCHIVE_RESTORE_DATE; |
1133 | 1133 | ||
1134 | #if ENABLE_FEATURE_TAR_FROM | 1134 | #if ENABLE_FEATURE_TAR_FROM |
1135 | /* Convert each -X EXCLFILE to list of to-be-rejected glob patterns */ | ||
1135 | tar_handle->reject = append_file_list_to_list(tar_handle->reject); | 1136 | tar_handle->reject = append_file_list_to_list(tar_handle->reject); |
1136 | # if ENABLE_FEATURE_TAR_LONG_OPTIONS | 1137 | # if ENABLE_FEATURE_TAR_LONG_OPTIONS |
1137 | /* Append excludes to reject */ | 1138 | /* Append --exclude=GLOBPATTERNs to reject */ |
1138 | while (excludes) { | 1139 | if (excludes) { |
1139 | llist_t *next = excludes->link; | 1140 | llist_t **p2next = &tar_handle->reject; |
1140 | excludes->link = tar_handle->reject; | 1141 | while (*p2next) |
1141 | tar_handle->reject = excludes; | 1142 | p2next = &((*p2next)->link); |
1142 | excludes = next; | 1143 | *p2next = excludes; |
1143 | } | 1144 | } |
1144 | # endif | 1145 | # endif |
1145 | tar_handle->accept = append_file_list_to_list(tar_handle->accept); | 1146 | tar_handle->accept = append_file_list_to_list(tar_handle->accept); |