aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-08-17 08:26:36 +0100
committerRon Yorston <rmy@pobox.com>2021-08-17 08:26:36 +0100
commitf13defb1c8f892ecf3e8dd5dbe486cc2b53e6f03 (patch)
tree15c9c174532e433e5632637c541d09e591c01d60 /archival
parent41f31584037be6b9d74a89245dff9ad8f0db146f (diff)
parent540aa116615713ad53e5ac98850993162e27c32d (diff)
downloadbusybox-w32-f13defb1c8f892ecf3e8dd5dbe486cc2b53e6f03.tar.gz
busybox-w32-f13defb1c8f892ecf3e8dd5dbe486cc2b53e6f03.tar.bz2
busybox-w32-f13defb1c8f892ecf3e8dd5dbe486cc2b53e6f03.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'archival')
-rw-r--r--archival/tar.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/archival/tar.c b/archival/tar.c
index 8cd371173..67c90e6fd 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -509,6 +509,9 @@ static int FAST_FUNC writeFileToTarball(struct recursive_state *state,
509 if (header_name[0] == '\0') 509 if (header_name[0] == '\0')
510 return TRUE; 510 return TRUE;
511 511
512 if (exclude_file(tbInfo->excludeList, header_name))
513 return SKIP; /* "do not recurse on this directory", no error message printed */
514
512 /* It is against the rules to archive a socket */ 515 /* It is against the rules to archive a socket */
513 if (S_ISSOCK(statbuf->st_mode)) { 516 if (S_ISSOCK(statbuf->st_mode)) {
514 bb_error_msg("%s: socket ignored", fileName); 517 bb_error_msg("%s: socket ignored", fileName);
@@ -548,9 +551,6 @@ static int FAST_FUNC writeFileToTarball(struct recursive_state *state,
548 } 551 }
549#endif 552#endif
550 553
551 if (exclude_file(tbInfo->excludeList, header_name))
552 return SKIP;
553
554# if !ENABLE_FEATURE_TAR_GNU_EXTENSIONS 554# if !ENABLE_FEATURE_TAR_GNU_EXTENSIONS
555 if (strlen(header_name) >= NAME_SIZE) { 555 if (strlen(header_name) >= NAME_SIZE) {
556 bb_simple_error_msg("names longer than "NAME_SIZE_STR" chars not supported"); 556 bb_simple_error_msg("names longer than "NAME_SIZE_STR" chars not supported");
@@ -563,13 +563,13 @@ static int FAST_FUNC writeFileToTarball(struct recursive_state *state,
563 /* open the file we want to archive, and make sure all is well */ 563 /* open the file we want to archive, and make sure all is well */
564 inputFileFd = open_or_warn(fileName, O_RDONLY); 564 inputFileFd = open_or_warn(fileName, O_RDONLY);
565 if (inputFileFd < 0) { 565 if (inputFileFd < 0) {
566 return FALSE; 566 return FALSE; /* make recursive_action() return FALSE */
567 } 567 }
568 } 568 }
569 569
570 /* Add an entry to the tarball */ 570 /* Add an entry to the tarball */
571 if (writeTarHeader(tbInfo, header_name, fileName, statbuf) == FALSE) { 571 if (writeTarHeader(tbInfo, header_name, fileName, statbuf) == FALSE) {
572 return FALSE; 572 return FALSE; /* make recursive_action() return FALSE */
573 } 573 }
574 574
575 /* If it was a regular file, write out the body */ 575 /* If it was a regular file, write out the body */
@@ -1153,14 +1153,15 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
1153 tar_handle->ah_flags &= ~ARCHIVE_RESTORE_DATE; 1153 tar_handle->ah_flags &= ~ARCHIVE_RESTORE_DATE;
1154 1154
1155#if ENABLE_FEATURE_TAR_FROM 1155#if ENABLE_FEATURE_TAR_FROM
1156 /* Convert each -X EXCLFILE to list of to-be-rejected glob patterns */
1156 tar_handle->reject = append_file_list_to_list(tar_handle->reject); 1157 tar_handle->reject = append_file_list_to_list(tar_handle->reject);
1157# if ENABLE_FEATURE_TAR_LONG_OPTIONS 1158# if ENABLE_FEATURE_TAR_LONG_OPTIONS
1158 /* Append excludes to reject */ 1159 /* Append --exclude=GLOBPATTERNs to reject */
1159 while (excludes) { 1160 if (excludes) {
1160 llist_t *next = excludes->link; 1161 llist_t **p2next = &tar_handle->reject;
1161 excludes->link = tar_handle->reject; 1162 while (*p2next)
1162 tar_handle->reject = excludes; 1163 p2next = &((*p2next)->link);
1163 excludes = next; 1164 *p2next = excludes;
1164 } 1165 }
1165# endif 1166# endif
1166 tar_handle->accept = append_file_list_to_list(tar_handle->accept); 1167 tar_handle->accept = append_file_list_to_list(tar_handle->accept);