From: Michihiro NAKAJIMA Date: Wed, 18 Jan 2012 02:30:20 +0000 (-0500) Subject: Correctly get file's ctime in archive_matching. X-Git-Tag: v3.0.4~2^2~180 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c15549d94b4f413f1caa5a1432190c58018bf13;p=thirdparty%2Flibarchive.git Correctly get file's ctime in archive_matching. SVN-Revision: 4165 --- diff --git a/libarchive/archive_matching.c b/libarchive/archive_matching.c index 581aab695..315a1e31d 100644 --- a/libarchive/archive_matching.c +++ b/libarchive/archive_matching.c @@ -818,7 +818,7 @@ archive_matching_newer_ctime_than(struct archive *_a, archive_set_error(&(a->archive), EINVAL, "pathname is empty"); return (ARCHIVE_FAILED); } - r = get_filetime_mbs(a, pathname, 0, &(a->newer_ctime_sec), + r = get_filetime_mbs(a, pathname, 1, &(a->newer_ctime_sec), &(a->newer_ctime_nsec)); if (r != ARCHIVE_OK) return (r); @@ -841,7 +841,7 @@ archive_matching_newer_ctime_than_w(struct archive *_a, const wchar_t *pathname) archive_set_error(&(a->archive), EINVAL, "pathname is empty"); return (ARCHIVE_FAILED); } - r = get_filetime_wcs(a, pathname, 0, &(a->newer_ctime_sec), + r = get_filetime_wcs(a, pathname, 1, &(a->newer_ctime_sec), &(a->newer_ctime_nsec)); if (r != ARCHIVE_OK) return (r); @@ -942,7 +942,7 @@ archive_matching_older_ctime_than(struct archive *_a, const char *pathname) archive_set_error(&(a->archive), EINVAL, "pathname is empty"); return (ARCHIVE_FAILED); } - r = get_filetime_mbs(a, pathname, 0, &(a->older_ctime_sec), + r = get_filetime_mbs(a, pathname, 1, &(a->older_ctime_sec), &(a->older_ctime_nsec)); if (r != ARCHIVE_OK) return (r); @@ -965,7 +965,7 @@ archive_matching_older_ctime_than_w(struct archive *_a, const wchar_t *pathname) archive_set_error(&(a->archive), EINVAL, "pathname is empty"); return (ARCHIVE_FAILED); } - r = get_filetime_wcs(a, pathname, 0, &(a->older_ctime_sec), + r = get_filetime_wcs(a, pathname, 1, &(a->older_ctime_sec), &(a->older_ctime_nsec)); if (r != ARCHIVE_OK) return (r); diff --git a/libarchive/test/test_archive_matching_time.c b/libarchive/test/test_archive_matching_time.c index 289cb15d9..e02f6cf76 100644 --- a/libarchive/test/test_archive_matching_time.c +++ b/libarchive/test/test_archive_matching_time.c @@ -146,6 +146,9 @@ test_newer_than_file_mbs(void) archive_read_free(a); return; } + assertUtimes("old", 10002, 0, 10002, 0); + assertUtimes("mid", 10001, 0, 10001, 0); + assertUtimes("new", 10000, 0, 10000, 0); assertEqualIntA(m, 0, archive_matching_newer_ctime_than(m, "mid")); /* Verify 'old' file. */ @@ -251,6 +254,9 @@ test_newer_than_file_wcs(void) archive_read_free(a); return; } + assertUtimes("old", 10002, 0, 10002, 0); + assertUtimes("mid", 10001, 0, 10001, 0); + assertUtimes("new", 10000, 0, 10000, 0); assertEqualIntA(m, 0, archive_matching_newer_ctime_than_w(m, L"mid")); /* Verify 'old' file. */ @@ -407,6 +413,9 @@ test_older_than_file_mbs(void) archive_read_free(a); return; } + assertUtimes("old", 10002, 0, 10002, 0); + assertUtimes("mid", 10001, 0, 10001, 0); + assertUtimes("new", 10000, 0, 10000, 0); assertEqualIntA(m, 0, archive_matching_older_ctime_than(m, "mid")); /* Verify 'old' file. */ @@ -512,6 +521,9 @@ test_older_than_file_wcs(void) archive_read_free(a); return; } + assertUtimes("old", 10002, 0, 10002, 0); + assertUtimes("mid", 10001, 0, 10001, 0); + assertUtimes("new", 10000, 0, 10000, 0); assertEqualIntA(m, 0, archive_matching_older_ctime_than_w(m, L"mid")); /* Verify 'old' file. */