summaryrefslogtreecommitdiffhomepage
path: root/archival
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-09-24 19:32:53 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-09-24 19:32:53 +0000
commite9b3321b9f4c85acd13db6fc5a6de821e597b6f9 (patch)
tree1dc1c93515fceb76f45c2f08ee307afda03f330b /archival
parent86e0a22ec602f929b1f3b1bd7d7b2f41cc86638c (diff)
tar: add a comment about previous subtle fix
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 bbda52d14..18b626701 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -386,6 +386,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf,
const char *header_name;
int inputFileFd = -1;
+ /* Strip leading '/' (must be before memorizing hardlink's name) */
header_name = fileName;
while (header_name[0] == '/') {
static smallint warned;
@@ -400,6 +401,12 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf,
if (header_name[0] == '\0')
return TRUE;
+ /* It is against the rules to archive a socket */
+ if (S_ISSOCK(statbuf->st_mode)) {
+ bb_error_msg("%s: socket ignored", fileName);
+ return TRUE;
+ }
+
/*
* Check to see if we are dealing with a hard link.
* If so -
@@ -414,12 +421,6 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf,
addHardLinkInfo(&tbInfo->hlInfoHead, statbuf, header_name);
}
- /* It is against the rules to archive a socket */
- if (S_ISSOCK(statbuf->st_mode)) {
- bb_error_msg("%s: socket ignored", fileName);
- return TRUE;
- }
-
/* It is a bad idea to store the archive we are in the process of creating,
* so check the device and inode to be sure that this particular file isn't
* the new tarball */