diff options
author | Michihiro NAKAJIMA <ggcueroad@gmail.com> | 2012-02-08 01:07:58 +0900 |
---|---|---|
committer | Michihiro NAKAJIMA <ggcueroad@gmail.com> | 2012-02-08 01:07:58 +0900 |
commit | c5356170ba6ae487ea7a1c80bb6d433eaf7715ec (patch) | |
tree | 198458b2a411feef007293bf9984eafc5d8e62c3 | |
parent | 753ecbf6526d89e1b119e13a677ad4f20f059012 (diff) | |
download | libarchive-c5356170ba6ae487ea7a1c80bb6d433eaf7715ec.tar.gz |
Fix refactoring error in archive_matching. archive_matching_exclude_entry
made opposite effect.
-rw-r--r-- | libarchive/archive_matching.c | 20 | ||||
-rw-r--r-- | libarchive/test/test_archive_matching_time.c | 9 |
2 files changed, 16 insertions, 13 deletions
diff --git a/libarchive/archive_matching.c b/libarchive/archive_matching.c index a3532386..a28fdd55 100644 --- a/libarchive/archive_matching.c +++ b/libarchive/archive_matching.c @@ -1336,40 +1336,40 @@ time_excluded(struct archive_matching *a, struct archive_entry *entry) if (f->flag & ARCHIVE_MATCHING_CTIME) { sec = archive_entry_ctime(entry); if (f->ctime_sec > sec) { - if (f->flag & ARCHIVE_MATCHING_NEWER) + if (f->flag & ARCHIVE_MATCHING_OLDER) return (1); } else if (f->ctime_sec < sec) { - if (f->flag & ARCHIVE_MATCHING_OLDER) + if (f->flag & ARCHIVE_MATCHING_NEWER) return (1); } else { nsec = archive_entry_ctime_nsec(entry); if (f->ctime_nsec > nsec) { - if (f->flag & ARCHIVE_MATCHING_NEWER) + if (f->flag & ARCHIVE_MATCHING_OLDER) return (1); } else if (f->ctime_nsec < nsec) { - if (f->flag & ARCHIVE_MATCHING_OLDER) + if (f->flag & ARCHIVE_MATCHING_NEWER) return (1); - } else if ((f->flag & ARCHIVE_MATCHING_EQUAL) == 0) + } else if (f->flag & ARCHIVE_MATCHING_EQUAL) return (1); } } if (f->flag & ARCHIVE_MATCHING_MTIME) { sec = archive_entry_mtime(entry); if (f->mtime_sec > sec) { - if (f->flag & ARCHIVE_MATCHING_NEWER) + if (f->flag & ARCHIVE_MATCHING_OLDER) return (1); } else if (f->mtime_sec < sec) { - if (f->flag & ARCHIVE_MATCHING_OLDER) + if (f->flag & ARCHIVE_MATCHING_NEWER) return (1); } else { nsec = archive_entry_mtime_nsec(entry); if (f->mtime_nsec > nsec) { - if (f->flag & ARCHIVE_MATCHING_NEWER) + if (f->flag & ARCHIVE_MATCHING_OLDER) return (1); } else if (f->mtime_nsec < nsec) { - if (f->flag & ARCHIVE_MATCHING_OLDER) + if (f->flag & ARCHIVE_MATCHING_NEWER) return (1); - } else if ((f->flag & ARCHIVE_MATCHING_EQUAL) == 0) + } else if (f->flag & ARCHIVE_MATCHING_EQUAL) return (1); } } diff --git a/libarchive/test/test_archive_matching_time.c b/libarchive/test/test_archive_matching_time.c index 92ce47cd..1cb2c59d 100644 --- a/libarchive/test/test_archive_matching_time.c +++ b/libarchive/test/test_archive_matching_time.c @@ -1272,15 +1272,18 @@ test_pathname_newer_mtime(void) archive_entry_copy_pathname(ae, "file1"); archive_entry_set_mtime(ae, 7880, 0); assertEqualIntA(m, 0, archive_matching_exclude_entry(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_NEWER, ae)); + ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_OLDER | + ARCHIVE_MATCHING_EQUAL, ae)); archive_entry_copy_pathname(ae, "file2"); archive_entry_set_mtime(ae, 1, 0); assertEqualIntA(m, 0, archive_matching_exclude_entry(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_NEWER, ae)); + ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_OLDER | + ARCHIVE_MATCHING_EQUAL, ae)); archive_entry_copy_pathname(ae, "file3"); archive_entry_set_mtime(ae, 99999, 0); assertEqualIntA(m, 0, archive_matching_exclude_entry(m, - ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_NEWER, ae)); + ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_OLDER | + ARCHIVE_MATCHING_EQUAL, ae)); excluded(m); |