]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Correctly get file's ctime in archive_matching.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Wed, 18 Jan 2012 02:30:20 +0000 (21:30 -0500)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Wed, 18 Jan 2012 02:30:20 +0000 (21:30 -0500)
SVN-Revision: 4165

libarchive/archive_matching.c
libarchive/test/test_archive_matching_time.c

index 581aab6958c1eea16fdc0742b146bc809df9bf9e..315a1e31d07096a58f4e1059aae0529a03022994 100644 (file)
@@ -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);
index 289cb15d974e03e88a89cf902ac7a2831f8f5e06..e02f6cf7677e6e3d87df7e95a1a09760c892123c 100644 (file)
@@ -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. */