summaryrefslogtreecommitdiff
path: root/archival/tar.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-01-24 22:02:01 +0000
committerDenis Vlasenko2007-01-24 22:02:01 +0000
commit218f2f4882482e1d023ddbf4b9f6cbf1f6b0145d (patch)
treee58717abf91e17db281fbbdfdc0072c198ce85b7 /archival/tar.c
parent84d2d493b4b664d1465cff955367fb9bc7769e5d (diff)
downloadbusybox-218f2f4882482e1d023ddbf4b9f6cbf1f6b0145d.zip
busybox-218f2f4882482e1d023ddbf4b9f6cbf1f6b0145d.tar.gz
accumulated post-1.4.0 fixes
Diffstat (limited to 'archival/tar.c')
-rw-r--r--archival/tar.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/archival/tar.c b/archival/tar.c
index 2ba51ad..ca59643 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -23,10 +23,10 @@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
-#include "busybox.h"
-#include "unarchive.h"
#include <fnmatch.h>
#include <getopt.h>
+#include "busybox.h"
+#include "unarchive.h"
#if ENABLE_FEATURE_TAR_CREATE
@@ -37,6 +37,7 @@
/* POSIX tar Header Block, from POSIX 1003.1-1990 */
#define NAME_SIZE 100
#define NAME_SIZE_STR "100"
+typedef struct TarHeader TarHeader;
struct TarHeader { /* byte offset */
char name[NAME_SIZE]; /* 0-99 */
char mode[8]; /* 100-107 */
@@ -56,7 +57,6 @@ struct TarHeader { /* byte offset */
char prefix[155]; /* 345-499 */
char padding[12]; /* 500-512 (pad to exactly the TAR_BLOCK_SIZE) */
};
-typedef struct TarHeader TarHeader;
/*
** writeTarFile(), writeFileToTarball(), and writeTarHeader() are
@@ -73,6 +73,7 @@ struct HardLinkInfo {
};
/* Some info to be carried along when creating a new tarball */
+typedef struct TarBallInfo TarBallInfo;
struct TarBallInfo {
int tarFd; /* Open-for-write file descriptor
for the tarball */
@@ -85,7 +86,6 @@ struct TarBallInfo {
HardLinkInfo *hlInfoHead; /* Hard Link Tracking Information */
HardLinkInfo *hlInfo; /* Hard Link Info for the current file */
};
-typedef struct TarBallInfo TarBallInfo;
/* A nice enum with all the possible tar file content types */
enum TarFileType {
@@ -348,7 +348,7 @@ static int writeTarHeader(struct TarBallInfo *tbInfo,
return TRUE;
}
-# if ENABLE_FEATURE_TAR_FROM
+#if ENABLE_FEATURE_TAR_FROM
static int exclude_file(const llist_t *excluded_files, const char *file)
{
while (excluded_files) {
@@ -371,12 +371,12 @@ static int exclude_file(const llist_t *excluded_files, const char *file)
return 0;
}
-# else
+#else
#define exclude_file(excluded_files, file) 0
-# endif
+#endif
static int writeFileToTarball(const char *fileName, struct stat *statbuf,
- void *userData, int depth)
+ void *userData, int depth ATTRIBUTE_UNUSED)
{
struct TarBallInfo *tbInfo = (struct TarBallInfo *) userData;
const char *header_name;
@@ -509,14 +509,14 @@ static int writeTarFile(const int tar_fd, const int verboseFlag,
if (pipe(gzipDataPipe) < 0 || pipe(gzipStatusPipe) < 0)
bb_perror_msg_and_die("pipe");
- signal(SIGPIPE, SIG_IGN); /* we only want EPIPE on errors */
+ signal(SIGPIPE, SIG_IGN); /* we only want EPIPE on errors */
-# if __GNUC__
+#if defined(__GNUC__) && __GNUC__
/* Avoid vfork clobbering */
(void) &include;
(void) &errorFlag;
(void) &zip_exec;
-# endif
+#endif
gzipPid = vfork();
@@ -600,7 +600,7 @@ static int writeTarFile(const int tar_fd, const int verboseFlag,
int writeTarFile(const int tar_fd, const int verboseFlag,
const unsigned long dereferenceFlag, const llist_t *include,
const llist_t *exclude, const int gzip);
-#endif /* tar_create */
+#endif /* FEATURE_TAR_CREATE */
#if ENABLE_FEATURE_TAR_FROM
static llist_t *append_file_list_to_list(llist_t *list)
@@ -628,7 +628,7 @@ static llist_t *append_file_list_to_list(llist_t *list)
return newlist;
}
#else
-#define append_file_list_to_list(x) 0
+#define append_file_list_to_list(x) 0
#endif
#if ENABLE_FEATURE_TAR_COMPRESS
@@ -653,7 +653,7 @@ static char get_header_tar_Z(archive_handle_t *archive_handle)
return EXIT_FAILURE;
}
#else
-#define get_header_tar_Z 0
+#define get_header_tar_Z NULL
#endif
#ifdef CHECK_FOR_CHILD_EXITCODE