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