X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=archival%2Ftar.c;h=ebaa965c051007129ec29ce543370d7516ba8a69;hb=1f937d64686d9a71c9325f2e9b23eba235a9255e;hp=f49fb129e593b48e2f39cb2669351ce62e8b7791;hpb=52827e3ebcd80f634f990030ee697254a0ae517d;p=oweals%2Fbusybox.git diff --git a/archival/tar.c b/archival/tar.c index f49fb129e..ebaa965c0 100644 --- a/archival/tar.c +++ b/archival/tar.c @@ -15,17 +15,17 @@ * Copyright (c) 1999 by David I. Bell * Permission is granted to use, distribute, or modify this source, * provided that this copyright notice remains intact. - * Permission to distribute sash derived code under the GPL has been granted. + * Permission to distribute sash derived code under GPL has been granted. * * Based in part on the tar implementation from busybox-0.28 * Copyright (C) 1995 Bruce Perens * - * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. + * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ #include #include "libbb.h" -#include "unarchive.h" +#include "archive.h" /* FIXME: Stop using this non-standard feature */ #ifndef FNM_LEADING_DIR # define FNM_LEADING_DIR 0 @@ -237,7 +237,7 @@ static int writeTarHeader(struct TarBallInfo *tbInfo, struct tar_header_t header; memset(&header, 0, sizeof(header)); - + strncpy(header.name, header_name, sizeof(header.name)); /* POSIX says to mask mode with 07777. */ @@ -514,9 +514,7 @@ static void NOINLINE vfork_compressor(int tar_fd, int gzip) (void) &zip_exec; # endif - gzipPid = vfork(); - if (gzipPid < 0) - bb_perror_msg_and_die("vfork"); + gzipPid = xvfork(); if (gzipPid == 0) { /* child */ @@ -574,8 +572,7 @@ static NOINLINE int writeTarFile(int tar_fd, int verboseFlag, /* Store the stat info for the tarball's file, so * can avoid including the tarball into itself.... */ - if (fstat(tbInfo.tarFd, &tbInfo.tarFileStatBuf) < 0) - bb_perror_msg_and_die("can't stat tar file"); + xfstat(tbInfo.tarFd, &tbInfo.tarFileStatBuf, "can't stat tar file"); #if ENABLE_FEATURE_SEAMLESS_GZ || ENABLE_FEATURE_SEAMLESS_BZ2 if (gzip) @@ -885,7 +882,6 @@ int tar_main(int argc UNUSED_PARAM, char **argv) /* Prepend '-' to the first argument if required */ opt_complementary = "--:" // first arg is options "tt:vv:" // count -t,-v - "?:" // bail out with usage instead of error return "X::T::" // cumulative lists #if ENABLE_FEATURE_TAR_LONG_OPTIONS && ENABLE_FEATURE_TAR_FROM "\xff::" // cumulative lists for --exclude