Remove debugging statement.
[oweals/busybox.git] / tar.c
diff --git a/tar.c b/tar.c
index 55fb12c2ca699fc87fbc72c97844b38779d11179..31443ee22aa7314d2c30922ce0363cf66864eaf4 100644 (file)
--- a/tar.c
+++ b/tar.c
@@ -330,7 +330,7 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
        size_t  writeSize;
        size_t  readSize;
        size_t  actualWriteSz;
-       char    buffer[BUFSIZ];
+       char    buffer[20 * TAR_BLOCK_SIZE];
        size_t  size = header->size;
        int outFd=fileno(stdout);
 
@@ -338,7 +338,9 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
        if (extractFlag==TRUE && tostdoutFlag==FALSE) {
                /* Create the path to the file, just in case it isn't there...
                 * This should not screw up path permissions or anything. */
-               create_path(header->name, 0777);
+               char *dir = dirname (header->name);
+               make_directory (dir, -1, FILEUTILS_RECUR);
+               free (dir);
                if ((outFd=open(header->name, O_CREAT|O_TRUNC|O_WRONLY, 
                                                header->mode & ~S_IFMT)) < 0) {
                        error_msg(io_error, header->name, strerror(errno)); 
@@ -352,9 +354,9 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
                if ( size > sizeof(buffer) )
                        writeSize = readSize = sizeof(buffer);
                else {
-                       int mod = size % 512;
+                       int mod = size % TAR_BLOCK_SIZE;
                        if ( mod != 0 )
-                               readSize = size + (512 - mod);
+                               readSize = size + (TAR_BLOCK_SIZE - mod);
                        else
                                readSize = size;
                        writeSize = size;
@@ -397,17 +399,8 @@ tarExtractDirectory(TarInfo *header, int extractFlag, int tostdoutFlag)
        if (extractFlag==FALSE || tostdoutFlag==TRUE)
                return( TRUE);
 
-       if (create_path(header->name, header->mode) != TRUE) {
-               perror_msg("%s: Cannot mkdir", header->name); 
+       if (make_directory(header->name, header->mode, FILEUTILS_RECUR) < 0)
                return( FALSE);
-       }
-       /* make the final component, just in case it was
-        * omitted by create_path() (which will skip the
-        * directory if it doesn't have a terminating '/') */
-       if (mkdir(header->name, header->mode) < 0 && errno != EEXIST) {
-               perror_msg("%s", header->name);
-               return FALSE;
-       }
 
        fixUpPermissions(header);
        return( TRUE);