diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-06-04 10:16:52 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-06-04 10:16:52 +0000 |
commit | 74324c86663f57a19c1de303ee8c8e5449db9ef2 (patch) | |
tree | 11f5da9de4212875ce5811be2e1050e076378c9a /archival | |
parent | 4e5f82c76f08614d0b69f9ec4a8baac303af15f6 (diff) | |
download | busybox-w32-74324c86663f57a19c1de303ee8c8e5449db9ef2.tar.gz busybox-w32-74324c86663f57a19c1de303ee8c8e5449db9ef2.tar.bz2 busybox-w32-74324c86663f57a19c1de303ee8c8e5449db9ef2.zip |
Audit bb_common_bufsiz usage, add script which looks for misuse.
tr: stop using globals needlessly.
code: -103 bytes
Diffstat (limited to 'archival')
-rw-r--r-- | archival/tar.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/archival/tar.c b/archival/tar.c index 432355353..adcedf615 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include "libbb.h" | 28 | #include "libbb.h" |
29 | #include "unarchive.h" | 29 | #include "unarchive.h" |
30 | 30 | ||
31 | #define block_buf bb_common_bufsiz1 | ||
32 | |||
31 | #if ENABLE_FEATURE_TAR_CREATE | 33 | #if ENABLE_FEATURE_TAR_CREATE |
32 | 34 | ||
33 | /* Tar file constants */ | 35 | /* Tar file constants */ |
@@ -475,8 +477,8 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, | |||
475 | /* Pad the file up to the tar block size */ | 477 | /* Pad the file up to the tar block size */ |
476 | /* (a few tricks here in the name of code size) */ | 478 | /* (a few tricks here in the name of code size) */ |
477 | readSize = (-(int)statbuf->st_size) & (TAR_BLOCK_SIZE-1); | 479 | readSize = (-(int)statbuf->st_size) & (TAR_BLOCK_SIZE-1); |
478 | memset(bb_common_bufsiz1, 0, readSize); | 480 | memset(block_buf, 0, readSize); |
479 | xwrite(tbInfo->tarFd, bb_common_bufsiz1, readSize); | 481 | xwrite(tbInfo->tarFd, block_buf, readSize); |
480 | } | 482 | } |
481 | 483 | ||
482 | return TRUE; | 484 | return TRUE; |
@@ -570,8 +572,8 @@ static int writeTarFile(const int tar_fd, const int verboseFlag, | |||
570 | include = include->link; | 572 | include = include->link; |
571 | } | 573 | } |
572 | /* Write two empty blocks to the end of the archive */ | 574 | /* Write two empty blocks to the end of the archive */ |
573 | memset(bb_common_bufsiz1, 0, 2*TAR_BLOCK_SIZE); | 575 | memset(block_buf, 0, 2*TAR_BLOCK_SIZE); |
574 | xwrite(tbInfo.tarFd, bb_common_bufsiz1, 2*TAR_BLOCK_SIZE); | 576 | xwrite(tbInfo.tarFd, block_buf, 2*TAR_BLOCK_SIZE); |
575 | 577 | ||
576 | /* To be pedantically correct, we would check if the tarball | 578 | /* To be pedantically correct, we would check if the tarball |
577 | * is smaller than 20 tar blocks, and pad it if it was smaller, | 579 | * is smaller than 20 tar blocks, and pad it if it was smaller, |