diff options
author | Martin Matuška <martin@matuska.org> | 2022-09-05 14:56:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-05 14:56:09 +0200 |
commit | 01a280fbf0794f575eb39d718a558896add18d30 (patch) | |
tree | 0544b462a0502d2aa0d74e61654c03e1e1572390 /libarchive | |
parent | 66d6e8a9166d3a340a16e1bd861fea9e1c186af3 (diff) | |
parent | 4471283392192f9ad38fd3085f8d32dbd07d6126 (diff) | |
download | libarchive-01a280fbf0794f575eb39d718a558896add18d30.tar.gz |
Merge pull request #1736 from uckelman-sf/mingw_fixes
Fixes for running tests on Windows (or Wine)
Diffstat (limited to 'libarchive')
-rw-r--r-- | libarchive/archive_read_support_format_mtree.c | 14 | ||||
-rw-r--r-- | libarchive/test/test_archive_match_time.c | 30 |
2 files changed, 41 insertions, 3 deletions
diff --git a/libarchive/archive_read_support_format_mtree.c b/libarchive/archive_read_support_format_mtree.c index 4a281632..55f391cf 100644 --- a/libarchive/archive_read_support_format_mtree.c +++ b/libarchive/archive_read_support_format_mtree.c @@ -1250,9 +1250,17 @@ parse_file(struct archive_read *a, struct archive_entry *entry, archive_entry_filetype(entry) == AE_IFDIR) { mtree->fd = open(path, O_RDONLY | O_BINARY | O_CLOEXEC); __archive_ensure_cloexec_flag(mtree->fd); - if (mtree->fd == -1 && - (errno != ENOENT || - archive_strlen(&mtree->contents_name) > 0)) { + if (mtree->fd == -1 && ( +#if defined(_WIN32) && !defined(__CYGWIN__) + /* + * On Windows, attempting to open a file with an + * invalid name result in EINVAL (Error 22) + */ + (errno != ENOENT && errno != EINVAL) +#else + errno != ENOENT +#endif + || archive_strlen(&mtree->contents_name) > 0)) { archive_set_error(&a->archive, errno, "Can't open %s", path); r = ARCHIVE_WARN; diff --git a/libarchive/test/test_archive_match_time.c b/libarchive/test/test_archive_match_time.c index c6864b32..23754a15 100644 --- a/libarchive/test/test_archive_match_time.c +++ b/libarchive/test/test_archive_match_time.c @@ -321,6 +321,11 @@ test_newer_ctime_than_file_mbs(void) struct archive_entry *ae; struct archive *m; +#if defined(_WIN32) && !defined(__CYGWIN__) + skipping("Can't set ctime on Windows"); + return; +#endif + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { @@ -435,6 +440,11 @@ test_newer_ctime_than_file_wcs(void) struct archive_entry *ae; struct archive *m; +#if defined(_WIN32) && !defined(__CYGWIN__) + skipping("Can't set ctime on Windows"); + return; +#endif + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { @@ -782,6 +792,11 @@ test_older_ctime_than_file_mbs(void) struct archive_entry *ae; struct archive *m; +#if defined(_WIN32) && !defined(__CYGWIN__) + skipping("Can't set ctime on Windows"); + return; +#endif + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { @@ -897,6 +912,11 @@ test_older_ctime_than_file_wcs(void) struct archive_entry *ae; struct archive *m; +#if defined(_WIN32) && !defined(__CYGWIN__) + skipping("Can't set ctime on Windows"); + return; +#endif + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { @@ -1073,6 +1093,11 @@ test_ctime_between_files_mbs(void) struct archive_entry *ae; struct archive *m; +#if defined(_WIN32) && !defined(__CYGWIN__) + skipping("Can't set ctime on Windows"); + return; +#endif + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { @@ -1132,6 +1157,11 @@ test_ctime_between_files_wcs(void) struct archive_entry *ae; struct archive *m; +#if defined(_WIN32) && !defined(__CYGWIN__) + skipping("Can't set ctime on Windows"); + return; +#endif + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { |