MCPcopy Create free account
hub / github.com/git/git / prepare_header

Function prepare_header

archive-tar.c:219–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217}
218
219static void prepare_header(struct archiver_args *args,
220 struct ustar_header *header,
221 unsigned int mode, unsigned long size)
222{
223 xsnprintf(header->mode, sizeof(header->mode), "%07o", mode & 07777);
224 xsnprintf(header->size, sizeof(header->size), "%011"PRIoMAX , S_ISREG(mode) ? (uintmax_t)size : (uintmax_t)0);
225 xsnprintf(header->mtime, sizeof(header->mtime), "%011lo", (unsigned long) args->time);
226
227 xsnprintf(header->uid, sizeof(header->uid), "%07o", 0);
228 xsnprintf(header->gid, sizeof(header->gid), "%07o", 0);
229 strlcpy(header->uname, "root", sizeof(header->uname));
230 strlcpy(header->gname, "root", sizeof(header->gname));
231 xsnprintf(header->devmajor, sizeof(header->devmajor), "%07o", 0);
232 xsnprintf(header->devminor, sizeof(header->devminor), "%07o", 0);
233
234 memcpy(header->magic, "ustar", 6);
235 memcpy(header->version, "00", 2);
236
237 xsnprintf(header->chksum, sizeof(header->chksum), "%07o", ustar_header_chksum(header));
238}
239
240static void write_extended_header(struct archiver_args *args,
241 const struct object_id *oid,

Callers 3

write_extended_headerFunction · 0.85
write_tar_entryFunction · 0.85

Calls 2

xsnprintfFunction · 0.85
ustar_header_chksumFunction · 0.85

Tested by

no test coverage detected