summaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorDenis Vlasenko2007-06-04 10:16:52 +0000
committerDenis Vlasenko2007-06-04 10:16:52 +0000
commit74324c86663f57a19c1de303ee8c8e5449db9ef2 (patch)
tree11f5da9de4212875ce5811be2e1050e076378c9a /archival
parent4e5f82c76f08614d0b69f9ec4a8baac303af15f6 (diff)
downloadbusybox-74324c86663f57a19c1de303ee8c8e5449db9ef2.zip
busybox-74324c86663f57a19c1de303ee8c8e5449db9ef2.tar.gz
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.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/archival/tar.c b/archival/tar.c
index 4323553..adcedf6 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -28,6 +28,8 @@
#include "libbb.h"
#include "unarchive.h"
+#define block_buf bb_common_bufsiz1
+
#if ENABLE_FEATURE_TAR_CREATE
/* Tar file constants */
@@ -475,8 +477,8 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf,
/* Pad the file up to the tar block size */
/* (a few tricks here in the name of code size) */
readSize = (-(int)statbuf->st_size) & (TAR_BLOCK_SIZE-1);
- memset(bb_common_bufsiz1, 0, readSize);
- xwrite(tbInfo->tarFd, bb_common_bufsiz1, readSize);
+ memset(block_buf, 0, readSize);
+ xwrite(tbInfo->tarFd, block_buf, readSize);
}
return TRUE;
@@ -570,8 +572,8 @@ static int writeTarFile(const int tar_fd, const int verboseFlag,
include = include->link;
}
/* Write two empty blocks to the end of the archive */
- memset(bb_common_bufsiz1, 0, 2*TAR_BLOCK_SIZE);
- xwrite(tbInfo.tarFd, bb_common_bufsiz1, 2*TAR_BLOCK_SIZE);
+ memset(block_buf, 0, 2*TAR_BLOCK_SIZE);
+ xwrite(tbInfo.tarFd, block_buf, 2*TAR_BLOCK_SIZE);
/* To be pedantically correct, we would check if the tarball
* is smaller than 20 tar blocks, and pad it if it was smaller,