From: Tim Kientzle Date: Sun, 27 Dec 2009 23:53:59 +0000 (-0500) Subject: Better error reporting when a file doesn't exist. X-Git-Tag: v2.8.0~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e5a084044fb49b729139a4d8ba8dcce8e7b1bc0;p=thirdparty%2Flibarchive.git Better error reporting when a file doesn't exist. SVN-Revision: 1779 --- diff --git a/cpio/test/main.c b/cpio/test/main.c index f1d7ba393..a8b68146e 100644 --- a/cpio/test/main.c +++ b/cpio/test/main.c @@ -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);