From: Tim Kientzle Date: Sat, 5 Sep 2009 06:10:52 +0000 (-0400) Subject: Don't try to do exact mode checks on Windows, since X-Git-Tag: v2.8.0~383 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b1542e79792ac1a339af413c9a65813b4b29b209;p=thirdparty%2Flibarchive.git Don't try to do exact mode checks on Windows, since Windows filesystems don't match Posix permissions. SVN-Revision: 1425 --- diff --git a/libarchive/test/main.c b/libarchive/test/main.c index b49fb1a31..9c75dfee5 100644 --- a/libarchive/test/main.c +++ b/libarchive/test/main.c @@ -190,6 +190,19 @@ count_assertion(const char *file, int line) /* printf("Checked %s:%d\n", file, line); */ } +/* + * Print a suitable leader for an error message. + */ +static void +error_leader(const char *filename, int line) +{ +#if _MSC_VER + return ("%s (%d): ", filename, line); +#else + printf ("%s:%d: ", filename, line); +#endif +} + /* * Count this failure; return true if this failure is being reported. */ @@ -207,7 +220,7 @@ report_failure(const char *filename, int line, const char *fmt, ...) if (failed_lines[line].count++ == 0 || verbose) { va_list ap; va_start(ap, fmt); - fprintf(stderr, "%s:%d: ", filename, line); + error_leader(filename, line); vfprintf(stderr, fmt, ap); va_end(ap); fprintf(stderr, "\n"); @@ -918,6 +931,10 @@ test_assert_is_reg(const char *file, int line, const char *pathname, int mode) finish_failure(NULL); return (0); } +#if !defined(_WIN32) || defined(__CYGWIN__) + /* Windows doesn't handle permissions the same way as POSIX, + * so just ignore the mode tests. */ + /* TODO: Can we do better here? */ if (mode < 0) return (1); if (mode != (st.st_mode & 07777)) { @@ -928,6 +945,7 @@ test_assert_is_reg(const char *file, int line, const char *pathname, int mode) } return (0); } +#endif return (1); }