1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-11-03 04:17:18 -05:00

Fail with assert() if open() fails

This is an attempt to resolve a coverity false positive in a somewhat
sane way.
This commit is contained in:
Moritz Grimm 2018-03-21 10:09:31 +01:00
parent 8c4fb52bd4
commit 429a39196e

View File

@ -1,6 +1,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <assert.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
@ -29,7 +30,7 @@ _test_cfgfile_rw(const char *cfgfile)
ck_assert_int_eq(cfg_file_reload(), 0); ck_assert_int_eq(cfg_file_reload(), 0);
fd = open(testfile, O_CREAT|O_EXCL|O_WRONLY, S_IRUSR|S_IWUSR); 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"); fp = fdopen(fd, "w");
if (NULL == fp) { if (NULL == fp) {
unlink(testfile); unlink(testfile);