MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ustar_checksum

Function ustar_checksum

freebsd/ddb/db_textdump.c:190–202  ·  view source on GitHub ↗

* Calculate and fill in the checksum for a ustar header. */

Source from the content-addressed store, hash-verified

188 * Calculate and fill in the checksum for a ustar header.
189 */
190static void
191ustar_checksum(struct ustar_header *uhp)
192{
193 u_int sum;
194 int i;
195
196 for (i = 0; i < sizeof(uhp->uh_sum); i++)
197 uhp->uh_sum[i] = ' ';
198 sum = 0;
199 for (i = 0; i < sizeof(*uhp); i++)
200 sum += ((u_char *)uhp)[i];
201 snprintf(uhp->uh_sum, sizeof(uhp->uh_sum), "%6o", sum);
202}
203
204/*
205 * Each file in the tarball has a block-sized header with its name and other,

Callers 1

textdump_mkustarFunction · 0.85

Calls 1

snprintfFunction · 0.85

Tested by

no test coverage detected