* Calculate and fill in the checksum for a ustar header. */
| 188 | * Calculate and fill in the checksum for a ustar header. |
| 189 | */ |
| 190 | static void |
| 191 | ustar_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, |
no test coverage detected