Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald van Dijk <harald@gigawatt.nl>2021-06-27 17:11:57 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2021-08-02 21:13:28 +0300
commit8ae6a4344d5d0f46e542d835ce4d218ff902c783 (patch)
tree3a4d01ef90ec30903a6cd329f5acb687a4088ace
parent3d40dfabe1049ecfbe05570b2287cfc5dbd33456 (diff)
tar: exclude files before updating hardlink info list
When excluding one file, and including another file that is a hardlink of the excluded file, it should be stored as an ordinary file. function old new delta writeFileToTarball 489 493 +4 Signed-off-by: Harald van Dijk <harald@gigawatt.nl> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--archival/tar.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/archival/tar.c b/archival/tar.c
index 879f6bf6f..94fb61a29 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -507,6 +507,9 @@ static int FAST_FUNC writeFileToTarball(struct recursive_state *state,
if (header_name[0] == '\0')
return TRUE;
+ if (exclude_file(tbInfo->excludeList, header_name))
+ return SKIP; /* "do not recurse on this directory", no error message printed */
+
/* It is against the rules to archive a socket */
if (S_ISSOCK(statbuf->st_mode)) {
bb_error_msg("%s: socket ignored", fileName);
@@ -540,9 +543,6 @@ static int FAST_FUNC writeFileToTarball(struct recursive_state *state,
return TRUE;
}
- if (exclude_file(tbInfo->excludeList, header_name))
- return SKIP;
-
# if !ENABLE_FEATURE_TAR_GNU_EXTENSIONS
if (strlen(header_name) >= NAME_SIZE) {
bb_simple_error_msg("names longer than "NAME_SIZE_STR" chars not supported");
@@ -555,13 +555,13 @@ static int FAST_FUNC writeFileToTarball(struct recursive_state *state,
/* open the file we want to archive, and make sure all is well */
inputFileFd = open_or_warn(fileName, O_RDONLY);
if (inputFileFd < 0) {
- return FALSE;
+ return FALSE; /* make recursive_action() return FALSE */
}
}
/* Add an entry to the tarball */
if (writeTarHeader(tbInfo, header_name, fileName, statbuf) == FALSE) {
- return FALSE;
+ return FALSE; /* make recursive_action() return FALSE */
}
/* If it was a regular file, write out the body */