From 429a39196ea3813884c304b641d16bb8ff5dd988 Mon Sep 17 00:00:00 2001 From: Moritz Grimm Date: Wed, 21 Mar 2018 10:09:31 +0100 Subject: [PATCH] Fail with assert() if open() fails This is an attempt to resolve a coverity false positive in a somewhat sane way. --- tests/check_cfgfile_xml.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/check_cfgfile_xml.c b/tests/check_cfgfile_xml.c index 2482244..2204f60 100644 --- a/tests/check_cfgfile_xml.c +++ b/tests/check_cfgfile_xml.c @@ -1,6 +1,7 @@ #include #include +#include #include #include #include @@ -29,7 +30,7 @@ _test_cfgfile_rw(const char *cfgfile) ck_assert_int_eq(cfg_file_reload(), 0); fd = open(testfile, O_CREAT|O_EXCL|O_WRONLY, S_IRUSR|S_IWUSR); - ck_assert_int_ge(fd, 0); + assert(0 <= fd); fp = fdopen(fd, "w"); if (NULL == fp) { unlink(testfile);