Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'procps/smemcap.c')
-rw-r--r--procps/smemcap.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/procps/smemcap.c b/procps/smemcap.c
index 2f8ab192e..2f1897dae 100644
--- a/procps/smemcap.c
+++ b/procps/smemcap.c
@@ -29,7 +29,6 @@ struct fileblock {
static void writeheader(const char *path, struct stat *sb, int type)
{
struct tar_header_t header;
- int i, sum;
memset(&header, 0, TAR_BLOCK_SIZE);
strcpy(header.name, path);
@@ -40,20 +39,7 @@ static void writeheader(const char *path, struct stat *sb, int type)
sprintf(header.size, "%o", (unsigned)sb->st_size);
sprintf(header.mtime, "%llo", sb->st_mtime & 077777777777LL);
header.typeflag = type;
- strcpy(header.magic, "ustar "); /* like GNU tar */
-
- /* Calculate and store the checksum (the sum of all of the bytes of
- * the header). The checksum field must be filled with blanks for the
- * calculation. The checksum field is formatted differently from the
- * other fields: it has 6 digits, a NUL, then a space -- rather than
- * digits, followed by a NUL like the other fields... */
- header.chksum[7] = ' ';
- sum = ' ' * 7;
- for (i = 0; i < TAR_BLOCK_SIZE; i++)
- sum += ((unsigned char*)&header)[i];
- sprintf(header.chksum, "%06o", sum);
-
- xwrite(STDOUT_FILENO, &header, TAR_BLOCK_SIZE);
+ chksum_and_xwrite_tar_header(STDOUT_FILENO, &header);
}
static void archivefile(const char *path)