]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Better error reporting when a file doesn't exist.
authorTim Kientzle <kientzle@gmail.com>
Sun, 27 Dec 2009 23:53:59 +0000 (18:53 -0500)
committerTim Kientzle <kientzle@gmail.com>
Sun, 27 Dec 2009 23:53:59 +0000 (18:53 -0500)
SVN-Revision: 1779

cpio/test/main.c

index f1d7ba393f70cd3db5a97bc2c6edc26e8d4d30c9..a8b68146eb7af98eba767e0b77ffd19e70f77766 100644 (file)
@@ -793,6 +793,12 @@ assertion_text_file_contents(const char *buff, const char *fn)
 
        assertion_count(test_filename, test_line);
        f = fopen(fn, "r");
+       if (f == NULL) {
+               failure_start(test_filename, test_line,
+                   "File doesn't exist: %s", fn);
+               failure_finish(test_extra);
+               return (0);
+       }
        s = strlen(buff);
        contents = malloc(s * 2 + 128);
        n = fread(contents, 1, s * 2 + 128 - 1, f);