Read 20 512-byte blocks at a time (like GNU tar).
authorMatt Kraai <kraai@debian.org>
Tue, 10 Jul 2001 15:05:39 +0000 (15:05 -0000)
committerMatt Kraai <kraai@debian.org>
Tue, 10 Jul 2001 15:05:39 +0000 (15:05 -0000)
archival/tar.c
tar.c

index 4702a5f8a33844a8cdd579551a69f6bdba91db0d..31443ee22aa7314d2c30922ce0363cf66864eaf4 100644 (file)
@@ -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);
 
@@ -354,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;
diff --git a/tar.c b/tar.c
index 4702a5f8a33844a8cdd579551a69f6bdba91db0d..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);
 
@@ -354,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;