aboutsummaryrefslogtreecommitdiffstats
path: root/libarchive/archive_read_support_format_xar.c
diff options
context:
space:
mode:
Diffstat (limited to 'libarchive/archive_read_support_format_xar.c')
-rw-r--r--libarchive/archive_read_support_format_xar.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/libarchive/archive_read_support_format_xar.c b/libarchive/archive_read_support_format_xar.c
index 602fc7722144..c4dd915a2c0e 100644
--- a/libarchive/archive_read_support_format_xar.c
+++ b/libarchive/archive_read_support_format_xar.c
@@ -167,6 +167,9 @@ struct xar_file {
#define HAS_FFLAGS 0x01000
#define HAS_XATTR 0x02000
#define HAS_ACL 0x04000
+#define HAS_CTIME 0x08000
+#define HAS_MTIME 0x10000
+#define HAS_ATIME 0x20000
uint64_t id;
uint64_t length;
@@ -695,9 +698,15 @@ xar_read_header(struct archive_read *a, struct archive_entry *entry)
*/
file_free(file);
}
- archive_entry_set_atime(entry, file->atime, 0);
- archive_entry_set_ctime(entry, file->ctime, 0);
- archive_entry_set_mtime(entry, file->mtime, 0);
+ if (file->has & HAS_ATIME) {
+ archive_entry_set_atime(entry, file->atime, 0);
+ }
+ if (file->has & HAS_CTIME) {
+ archive_entry_set_ctime(entry, file->ctime, 0);
+ }
+ if (file->has & HAS_MTIME) {
+ archive_entry_set_mtime(entry, file->mtime, 0);
+ }
archive_entry_set_gid(entry, file->gid);
if (file->gname.length > 0 &&
archive_entry_copy_gname_l(entry, file->gname.s,
@@ -967,7 +976,7 @@ move_reading_point(struct archive_read *a, uint64_t offset)
return ((int)step);
xar->offset += step;
} else {
- int64_t pos = __archive_read_seek(a, offset, SEEK_SET);
+ int64_t pos = __archive_read_seek(a, xar->h_base + offset, SEEK_SET);
if (pos == ARCHIVE_FAILED) {
archive_set_error(&(a->archive),
ARCHIVE_ERRNO_MISC,
@@ -1767,8 +1776,8 @@ file_new(struct archive_read *a, struct xar *xar, struct xmlattr_list *list)
}
file->parent = xar->file;
file->mode = 0777 | AE_IFREG;
- file->atime = time(NULL);
- file->mtime = time(NULL);
+ file->atime = 0;
+ file->mtime = 0;
xar->file = file;
xar->xattr = NULL;
for (attr = list->first; attr != NULL; attr = attr->next) {
@@ -2751,15 +2760,15 @@ xml_data(void *userData, const char *s, int len)
xar->file->uid = atol10(s, len);
break;
case FILE_CTIME:
- xar->file->has |= HAS_TIME;
+ xar->file->has |= HAS_TIME | HAS_CTIME;
xar->file->ctime = parse_time(s, len);
break;
case FILE_MTIME:
- xar->file->has |= HAS_TIME;
+ xar->file->has |= HAS_TIME | HAS_MTIME;
xar->file->mtime = parse_time(s, len);
break;
case FILE_ATIME:
- xar->file->has |= HAS_TIME;
+ xar->file->has |= HAS_TIME | HAS_ATIME;
xar->file->atime = parse_time(s, len);
break;
case FILE_DATA_LENGTH: