Read 20 512-byte blocks at a time (like GNU tar).
This commit is contained in:
parent
654944fc36
commit
5710f9f690
@ -330,7 +330,7 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
|
|||||||
size_t writeSize;
|
size_t writeSize;
|
||||||
size_t readSize;
|
size_t readSize;
|
||||||
size_t actualWriteSz;
|
size_t actualWriteSz;
|
||||||
char buffer[BUFSIZ];
|
char buffer[20 * TAR_BLOCK_SIZE];
|
||||||
size_t size = header->size;
|
size_t size = header->size;
|
||||||
int outFd=fileno(stdout);
|
int outFd=fileno(stdout);
|
||||||
|
|
||||||
@ -354,9 +354,9 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
|
|||||||
if ( size > sizeof(buffer) )
|
if ( size > sizeof(buffer) )
|
||||||
writeSize = readSize = sizeof(buffer);
|
writeSize = readSize = sizeof(buffer);
|
||||||
else {
|
else {
|
||||||
int mod = size % 512;
|
int mod = size % TAR_BLOCK_SIZE;
|
||||||
if ( mod != 0 )
|
if ( mod != 0 )
|
||||||
readSize = size + (512 - mod);
|
readSize = size + (TAR_BLOCK_SIZE - mod);
|
||||||
else
|
else
|
||||||
readSize = size;
|
readSize = size;
|
||||||
writeSize = size;
|
writeSize = size;
|
||||||
|
6
tar.c
6
tar.c
@ -330,7 +330,7 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
|
|||||||
size_t writeSize;
|
size_t writeSize;
|
||||||
size_t readSize;
|
size_t readSize;
|
||||||
size_t actualWriteSz;
|
size_t actualWriteSz;
|
||||||
char buffer[BUFSIZ];
|
char buffer[20 * TAR_BLOCK_SIZE];
|
||||||
size_t size = header->size;
|
size_t size = header->size;
|
||||||
int outFd=fileno(stdout);
|
int outFd=fileno(stdout);
|
||||||
|
|
||||||
@ -354,9 +354,9 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
|
|||||||
if ( size > sizeof(buffer) )
|
if ( size > sizeof(buffer) )
|
||||||
writeSize = readSize = sizeof(buffer);
|
writeSize = readSize = sizeof(buffer);
|
||||||
else {
|
else {
|
||||||
int mod = size % 512;
|
int mod = size % TAR_BLOCK_SIZE;
|
||||||
if ( mod != 0 )
|
if ( mod != 0 )
|
||||||
readSize = size + (512 - mod);
|
readSize = size + (TAR_BLOCK_SIZE - mod);
|
||||||
else
|
else
|
||||||
readSize = size;
|
readSize = size;
|
||||||
writeSize = size;
|
writeSize = size;
|
||||||
|
Loading…
Reference in New Issue
Block a user