# endif
static int writeFileToTarball(const char *fileName, struct stat *statbuf,
- void *userData)
+ void *userData, int depth)
{
struct TarBallInfo *tbInfo = (struct TarBallInfo *) userData;
const char *header_name;
/* If it was a regular file, write out the body */
if (inputFileFd >= 0) {
- ssize_t readSize = 0;
+ off_t readSize = 0;
/* write the file to the archive */
readSize = bb_copyfd_eof(inputFileFd, tbInfo->tarFd);
if (n == 0 && vfork_exec_errno != 0) {
errno = vfork_exec_errno;
- bb_perror_msg_and_die("Could not exec %s", zip_exec);
+ bb_perror_msg_and_die("cannot exec %s", zip_exec);
} else if ((n < 0) && (errno == EAGAIN || errno == EINTR))
continue; /* try it again */
break;
/* Read the directory/files and iterate over them one at a time */
while (include) {
if (!recursive_action(include->data, TRUE, dereferenceFlag,
- FALSE, writeFileToTarball, writeFileToTarball, &tbInfo))
+ FALSE, writeFileToTarball, writeFileToTarball, &tbInfo, 0))
{
errorFlag = TRUE;
}
freeHardLinkInfo(&tbInfo.hlInfoHead);
if (errorFlag)
- bb_error_msg("Error exit delayed from previous errors");
+ bb_error_msg("error exit delayed from previous errors");
if (gzipPid && waitpid(gzipPid, NULL, 0)==-1)
- bb_error_msg("Couldnt wait");
+ bb_error_msg("cannot wait");
return !errorFlag;
}
tmp = cur;
cur = cur->link;
free(tmp);
- while ((line = bb_get_chomped_line_from_file(src_stream)) != NULL) {
+ while ((line = xmalloc_getline(src_stream)) != NULL) {
char *filename_ptr = last_char_is(line, '/');
if (filename_ptr > line)
*filename_ptr = '\0';
#ifdef CONFIG_FEATURE_TAR_COMPRESS
static char get_header_tar_Z(archive_handle_t *archive_handle)
{
- /* Cant lseek over pipe's */
- archive_handle->seek = seek_by_char;
+ /* Can't lseek over pipes */
+ archive_handle->seek = seek_by_read;
/* do the decompression, and cleanup */
if (xread_char(archive_handle->src_fd) != 0x1f ||
/* nothing */;
/* Can only do one file at a time */
- return(EXIT_FAILURE);
+ return EXIT_FAILURE;
}
#else
#define get_header_tar_Z 0
archive_handle_t *tar_handle;
char *base_dir = NULL;
const char *tar_filename = "-";
- unsigned long opt;
+ unsigned opt;
llist_t *excludes = NULL;
/* Initialise default values */
tar_handle->flags = ARCHIVE_CREATE_LEADING_DIRS | ARCHIVE_PRESERVE_DATE | ARCHIVE_EXTRACT_UNCONDITIONAL;
/* Prepend '-' to the first argument if required */
- bb_opt_complementally = ENABLE_FEATURE_TAR_CREATE ?
+ opt_complementary = ENABLE_FEATURE_TAR_CREATE ?
"--:X::T::\n::c:t:x:?:c--tx:t--cx:x--ct" :
"--:X::T::\n::t:x:?:t--x:x--t";
if (ENABLE_FEATURE_TAR_LONG_OPTIONS)
- bb_applet_long_options = tar_long_options;
- opt = bb_getopt_ulflags(argc, argv, tar_options,
+ applet_long_options = tar_long_options;
+ opt = getopt32(argc, argv, tar_options,
&base_dir, /* Change to dir <optarg> */
&tar_filename /* archive filename */
#ifdef CONFIG_FEATURE_TAR_FROM
if ((tar_handle->action_header == header_list) ||
(tar_handle->action_header == header_verbose_list))
{
- tar_handle->action_header = header_verbose_list;
+ tar_handle->action_header = header_verbose_list;
} else tar_handle->action_header = header_list;
}
if((opt & CTX_EXTRACT) && tar_handle->action_data != data_extract_to_stdout)
if ((tar_filename[0] == '-') && (tar_filename[1] == '\0')) {
tar_handle->src_fd = fileno(tar_stream);
- tar_handle->seek = seek_by_char;
+ tar_handle->seek = seek_by_read;
} else {
tar_handle->src_fd = xopen3(tar_filename, flags, 0666);
}