]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
On Windows, set 'Creation time' to both birthtime and ctime, because
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Sun, 23 Jan 2011 01:32:42 +0000 (20:32 -0500)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Sun, 23 Jan 2011 01:32:42 +0000 (20:32 -0500)
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

libarchive/archive_entry_copy_bhfi.c
libarchive/archive_read_disk_windows.c
libarchive/archive_read_support_format_lha.c

index 8339032c5c35687f79883b6b79fae1740d986c08..c6f9e68b0cd000f3f866ff4acf6cb1be6f491de2 100644 (file)
@@ -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);
index 251b3d444cf5d13b6b2cb4028ce2a7fdfac5952d..30218d95c49e66cafc179aee2a849f8d57a6afb5 100644 (file)
@@ -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)
index f60081b2ead64e0a973f884cbdee647283c32d77..feaccc076185802efc9bb3eb3feaebfc4245cb64 100644 (file)
@@ -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);