data is alvays 1970
texrg opened this issue · 1 comments
texrg commented
Is possible to add function to set/read data creating file inside tar?
rxi commented
If you want more control when writing a header use the mtar_write_header() function. The implementation of mtar_write_file_header() can be used as a starting point. The mtime field can be used to set the modified time:
int mtar_write_file_header(mtar_t *tar, const char *name, unsigned size) {
mtar_header_t h;
/* Build header */
memset(&h, 0, sizeof(h));
strcpy(h.name, name);
h.size = size;
h.type = MTAR_TREG;
h.mode = 0664;
/* Write header */
return mtar_write_header(tar, &h);
}