diff options
Diffstat (limited to 'procps')
-rw-r--r-- | procps/smemcap.c | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/procps/smemcap.c b/procps/smemcap.c index 01acbf74e..429cc8a3e 100644 --- a/procps/smemcap.c +++ b/procps/smemcap.c | |||
@@ -30,7 +30,6 @@ struct fileblock { | |||
30 | static void writeheader(const char *path, struct stat *sb, int type) | 30 | static void writeheader(const char *path, struct stat *sb, int type) |
31 | { | 31 | { |
32 | struct tar_header_t header; | 32 | struct tar_header_t header; |
33 | int i, sum; | ||
34 | 33 | ||
35 | memset(&header, 0, TAR_BLOCK_SIZE); | 34 | memset(&header, 0, TAR_BLOCK_SIZE); |
36 | strcpy(header.name, path); | 35 | strcpy(header.name, path); |
@@ -41,20 +40,7 @@ static void writeheader(const char *path, struct stat *sb, int type) | |||
41 | sprintf(header.size, "%o", (unsigned)sb->st_size); | 40 | sprintf(header.size, "%o", (unsigned)sb->st_size); |
42 | sprintf(header.mtime, "%llo", sb->st_mtime & 077777777777LL); | 41 | sprintf(header.mtime, "%llo", sb->st_mtime & 077777777777LL); |
43 | header.typeflag = type; | 42 | header.typeflag = type; |
44 | strcpy(header.magic, "ustar "); /* like GNU tar */ | 43 | chksum_and_xwrite_tar_header(STDOUT_FILENO, &header); |
45 | |||
46 | /* Calculate and store the checksum (the sum of all of the bytes of | ||
47 | * the header). The checksum field must be filled with blanks for the | ||
48 | * calculation. The checksum field is formatted differently from the | ||
49 | * other fields: it has 6 digits, a NUL, then a space -- rather than | ||
50 | * digits, followed by a NUL like the other fields... */ | ||
51 | header.chksum[7] = ' '; | ||
52 | sum = ' ' * 7; | ||
53 | for (i = 0; i < TAR_BLOCK_SIZE; i++) | ||
54 | sum += ((unsigned char*)&header)[i]; | ||
55 | sprintf(header.chksum, "%06o", sum); | ||
56 | |||
57 | xwrite(STDOUT_FILENO, &header, TAR_BLOCK_SIZE); | ||
58 | } | 44 | } |
59 | 45 | ||
60 | static void archivefile(const char *path) | 46 | static void archivefile(const char *path) |