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>
This commit is contained in:
Denys Vlasenko 2021-08-02 19:58:13 +02:00
parent 37460f5daf
commit 3d40dfabe1

View File

@ -1132,14 +1132,15 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
tar_handle->ah_flags &= ~ARCHIVE_RESTORE_DATE; tar_handle->ah_flags &= ~ARCHIVE_RESTORE_DATE;
#if ENABLE_FEATURE_TAR_FROM #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); tar_handle->reject = append_file_list_to_list(tar_handle->reject);
# if ENABLE_FEATURE_TAR_LONG_OPTIONS # if ENABLE_FEATURE_TAR_LONG_OPTIONS
/* Append excludes to reject */ /* Append --exclude=GLOBPATTERNs to reject */
while (excludes) { if (excludes) {
llist_t *next = excludes->link; llist_t **p2next = &tar_handle->reject;
excludes->link = tar_handle->reject; while (*p2next)
tar_handle->reject = excludes; p2next = &((*p2next)->link);
excludes = next; *p2next = excludes;
} }
# endif # endif
tar_handle->accept = append_file_list_to_list(tar_handle->accept); tar_handle->accept = append_file_list_to_list(tar_handle->accept);