void simple_finish_header (union block *header);
union block * write_extended (bool global, struct tar_stat_info *st,
union block *old_header);
-union block *start_private_header (const char *name, size_t size);
+union block *start_private_header (const char *name, size_t size, time_t t);
void write_eot (void);
void check_links (void);
void exclusion_tag_warning (const char *dirname, const char *tagname,
void xheader_store (char const *keyword, struct tar_stat_info *st,
void const *data);
void xheader_read (struct xheader *xhdr, union block *header, size_t size);
-void xheader_write (char type, char *name, struct xheader *xhdr);
+void xheader_write (char type, char *name, time_t t, struct xheader *xhdr);
void xheader_write_global (struct xheader *xhdr);
void xheader_finish (struct xheader *hdr);
void xheader_destroy (struct xheader *hdr);
/* Write a "private" header */
union block *
-start_private_header (const char *name, size_t size)
+start_private_header (const char *name, size_t size, time_t t)
{
- time_t t;
union block *header = find_next_block ();
memset (header->buffer, 0, sizeof (union block));
tar_name_copy_str (header->header.name, name, NAME_FIELD_SIZE);
OFF_TO_CHARS (size, header->header.size);
- time (&t);
TIME_TO_CHARS (t, header->header.mtime);
MODE_TO_CHARS (S_IFREG|S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH, header->header.mode);
UID_TO_CHARS (getuid (), header->header.uid);
union block *header;
char *tmpname;
- header = start_private_header ("././@LongLink", size);
- FILL(header->header.mtime, '0');
- FILL(header->header.mode, '0');
- FILL(header->header.uid, '0');
- FILL(header->header.gid, '0');
- FILL(header->header.devmajor, 0);
- FILL(header->header.devminor, 0);
+ header = start_private_header ("././@LongLink", size, time (NULL));
+ FILL (header->header.mtime, '0');
+ FILL (header->header.mode, '0');
+ FILL (header->header.uid, '0');
+ FILL (header->header.gid, '0');
+ FILL (header->header.devmajor, 0);
+ FILL (header->header.devminor, 0);
uid_to_uname (0, &tmpname);
UNAME_TO_CHARS (tmpname, header->header.uname);
free (tmpname);
union block *header, hp;
char *p;
int type;
-
+ time_t t;
+
if (st->xhdr.buffer || st->xhdr.stk == NULL)
return old_header;
{
type = XGLTYPE;
p = xheader_ghdr_name ();
+ time (&t);
}
else
{
type = XHDTYPE;
p = xheader_xhdr_name (st);
+ t = st->stat.st_mtime;
}
- xheader_write (type, p, &st->xhdr);
+ xheader_write (type, p, t, &st->xhdr);
free (p);
header = find_next_block ();
memcpy (header, &hp.buffer, sizeof (hp.buffer));
}
void
-xheader_write (char type, char *name, struct xheader *xhdr)
+xheader_write (char type, char *name, time_t t, struct xheader *xhdr)
{
union block *header;
size_t size;
char *p;
size = xhdr->size;
- header = start_private_header (name, size);
+ header = start_private_header (name, size, t);
header->header.typeflag = type;
simple_finish_header (header);
for (kp = keyword_global_override_list; kp; kp = kp->next)
code_string (kp->value, kp->pattern, xhdr);
xheader_finish (xhdr);
- xheader_write (XGLTYPE, name = xheader_ghdr_name (), xhdr);
+ xheader_write (XGLTYPE, name = xheader_ghdr_name (), time (NULL), xhdr);
free (name);
}