From: Michihiro NAKAJIMA Date: Sun, 23 Jan 2011 01:32:42 +0000 (-0500) Subject: On Windows, set 'Creation time' to both birthtime and ctime, because X-Git-Tag: v3.0.0a~724 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9476b41fd6f9c8ea05a3a0f28994fceb33210d16;p=thirdparty%2Flibarchive.git On Windows, set 'Creation time' to both birthtime and ctime, because CRT stat() Microsoft provides set 'Creation time' to st_ctime. It seems we should do that not to confuse applications about ctime. SVN-Revision: 2938 --- diff --git a/libarchive/archive_entry_copy_bhfi.c b/libarchive/archive_entry_copy_bhfi.c index 8339032c5..c6f9e68b0 100644 --- a/libarchive/archive_entry_copy_bhfi.c +++ b/libarchive/archive_entry_copy_bhfi.c @@ -63,6 +63,7 @@ archive_entry_copy_bhfi(struct archive_entry *entry, archive_entry_set_mtime(entry, secs, nsecs); fileTimeToUtc(&bhfi->ftCreationTime, &secs, &nsecs); archive_entry_set_birthtime(entry, secs, nsecs); + archive_entry_set_ctime(entry, secs, nsecs); archive_entry_set_dev(entry, bhfi->dwVolumeSerialNumber); archive_entry_set_ino64(entry, (((int64_t)bhfi->nFileIndexHigh) << 32) + bhfi->nFileIndexLow); diff --git a/libarchive/archive_read_disk_windows.c b/libarchive/archive_read_disk_windows.c index 251b3d444..30218d95c 100644 --- a/libarchive/archive_read_disk_windows.c +++ b/libarchive/archive_read_disk_windows.c @@ -1597,6 +1597,7 @@ tree_archive_entry_copy_bhfi(struct archive_entry *entry, struct tree *t, archive_entry_set_mtime(entry, secs, nsecs); fileTimeToUtc(&bhfi->ftCreationTime, &secs, &nsecs); archive_entry_set_birthtime(entry, secs, nsecs); + archive_entry_set_ctime(entry, secs, nsecs); archive_entry_set_dev(entry, bhfi_dev(bhfi)); archive_entry_set_ino64(entry, bhfi_ino(bhfi)); if (bhfi->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) diff --git a/libarchive/archive_read_support_format_lha.c b/libarchive/archive_read_support_format_lha.c index f60081b2e..feaccc076 100644 --- a/libarchive/archive_read_support_format_lha.c +++ b/libarchive/archive_read_support_format_lha.c @@ -621,13 +621,16 @@ archive_read_format_lha_read_header(struct archive_read *a, archive_entry_set_uname(entry, lha->uname.s); if (archive_strlen(&lha->gname) > 0) archive_entry_set_gname(entry, lha->gname.s); - if (lha->setflag & BIRTHTIME_IS_SET) + if (lha->setflag & BIRTHTIME_IS_SET) { archive_entry_set_birthtime(entry, lha->birthtime, lha->birthtime_tv_nsec); - else + archive_entry_set_ctime(entry, lha->birthtime, + lha->birthtime_tv_nsec); + } else { archive_entry_unset_birthtime(entry); + archive_entry_unset_ctime(entry); + } archive_entry_set_mtime(entry, lha->mtime, lha->mtime_tv_nsec); - archive_entry_unset_ctime(entry); if (lha->setflag & ATIME_IS_SET) archive_entry_set_atime(entry, lha->atime, lha->atime_tv_nsec);