Commit 4ac862fa authored by Mark Andrews's avatar Mark Andrews
Browse files

only execute additional tests if create call succeeds

parent 11dc1b15
......@@ -59,17 +59,21 @@ ATF_TC_BODY(isc_file_sanitize, tc) {
fd = creat(F(TRUNC_SHA), 0644);
ATF_CHECK(fd != -1);
result = isc_file_sanitize("testdata/file", NAME, "test", buf, 1024);
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
ATF_CHECK(strcmp(buf, F(TRUNC_SHA)) == 0);
close(fd);
if (fd != -1) {
result = isc_file_sanitize("testdata/file", NAME, "test", buf, 1024);
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
ATF_CHECK(strcmp(buf, F(TRUNC_SHA)) == 0);
close(fd);
}
fd = creat(F(SHA), 0644);
ATF_CHECK(fd != -1);
result = isc_file_sanitize("testdata/file", NAME, "test", buf, 1024);
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
ATF_CHECK(strcmp(buf, F(SHA)) == 0);
close(fd);
if (fd != -1) {
result = isc_file_sanitize("testdata/file", NAME, "test", buf, 1024);
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
ATF_CHECK(strcmp(buf, F(SHA)) == 0);
close(fd);
}
result = isc_file_sanitize("testdata/file", BAD1, "test", buf, 1024);
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment