]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Be more tolerant of end-of-line variations.
authorTim Kientzle <kientzle@gmail.com>
Mon, 28 Dec 2009 00:00:45 +0000 (19:00 -0500)
committerTim Kientzle <kientzle@gmail.com>
Mon, 28 Dec 2009 00:00:45 +0000 (19:00 -0500)
SVN-Revision: 1782

cpio/test/test_option_version.c

index 722b600c5cf3fbfc68805101862c1f3959047f2c..7345da1e5157923ce29ee69609c18e014555158f 100644 (file)
@@ -74,14 +74,14 @@ verify(const char *p, size_t s)
        /* Skip a single trailing a,b,c, or d. */
        if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd')
                ++q;
-       /* All terminated by a newline. */
+       /* All terminated by end-of-line: \r, \r\n, or \n */
        assert(s >= 1);
        failure("Version: %s", p);
-#if defined(_WIN32) && !defined(__CYGWIN__)
-       assertEqualMem(q, "\x0d\x0a", 2);
-#else
-       assertEqualMem(q, "\x0a", 1);
-#endif
+       if (*q == '\x0d') {
+               if (q[1] != '\0')
+                       assertEqualMem(q, "\x0d\x0a", 2);
+       } else
+               assertEqualMem(q, "\x0a", 1);
 }