1 --- busybox-1.4.0/archival/tar.c Fri Jan 19 22:23:02 2007
2 +++ busybox-1.4.0-tar/archival/tar.c Wed Jan 24 21:32:00 2007
4 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
8 -#include "unarchive.h"
12 +#include "unarchive.h"
14 #if ENABLE_FEATURE_TAR_CREATE
17 /* POSIX tar Header Block, from POSIX 1003.1-1990 */
19 #define NAME_SIZE_STR "100"
20 +typedef struct TarHeader TarHeader;
21 struct TarHeader { /* byte offset */
22 char name[NAME_SIZE]; /* 0-99 */
23 char mode[8]; /* 100-107 */
25 char prefix[155]; /* 345-499 */
26 char padding[12]; /* 500-512 (pad to exactly the TAR_BLOCK_SIZE) */
28 -typedef struct TarHeader TarHeader;
31 ** writeTarFile(), writeFileToTarball(), and writeTarHeader() are
35 /* Some info to be carried along when creating a new tarball */
36 +typedef struct TarBallInfo TarBallInfo;
38 int tarFd; /* Open-for-write file descriptor
41 HardLinkInfo *hlInfoHead; /* Hard Link Tracking Information */
42 HardLinkInfo *hlInfo; /* Hard Link Info for the current file */
44 -typedef struct TarBallInfo TarBallInfo;
46 /* A nice enum with all the possible tar file content types */
52 -# if ENABLE_FEATURE_TAR_FROM
53 +#if ENABLE_FEATURE_TAR_FROM
54 static int exclude_file(const llist_t *excluded_files, const char *file)
56 while (excluded_files) {
63 #define exclude_file(excluded_files, file) 0
67 static int writeFileToTarball(const char *fileName, struct stat *statbuf,
68 - void *userData, int depth)
69 + void *userData, int depth ATTRIBUTE_UNUSED)
71 struct TarBallInfo *tbInfo = (struct TarBallInfo *) userData;
72 const char *header_name;
74 if (pipe(gzipDataPipe) < 0 || pipe(gzipStatusPipe) < 0)
75 bb_perror_msg_and_die("pipe");
77 - signal(SIGPIPE, SIG_IGN); /* we only want EPIPE on errors */
78 + signal(SIGPIPE, SIG_IGN); /* we only want EPIPE on errors */
81 +#if defined(__GNUC__) && __GNUC__
82 /* Avoid vfork clobbering */
92 int writeTarFile(const int tar_fd, const int verboseFlag,
93 const unsigned long dereferenceFlag, const llist_t *include,
94 const llist_t *exclude, const int gzip);
95 -#endif /* tar_create */
96 +#endif /* FEATURE_TAR_CREATE */
98 #if ENABLE_FEATURE_TAR_FROM
99 static llist_t *append_file_list_to_list(llist_t *list)
104 -#define append_file_list_to_list(x) 0
105 +#define append_file_list_to_list(x) 0
108 #if ENABLE_FEATURE_TAR_COMPRESS
113 -#define get_header_tar_Z 0
114 +#define get_header_tar_Z NULL
117 #ifdef CHECK_FOR_CHILD_EXITCODE