Coverity notices that the checks against mkstemp() failing in
create_qcow2_with_mbr() are wrong: mkstemp returns -1 on failure but
the check is just "g_assert(fd)". Fix to use "g_assert(fd >= 0)",
matching the correct check in create_test_img().
Fixes: Coverity CID 1432274
Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Stefan Berger <[email protected]>
Message-id:
20210525134458[email protected]
}
fd = mkstemp(raw_path);
- g_assert(fd);
+ g_assert(fd >= 0);
close(fd);
fd = open(raw_path, O_WRONLY);
close(fd);
fd = mkstemp(qcow2_path);
- g_assert(fd);
+ g_assert(fd >= 0);
close(fd);
qemu_img_path = getenv("QTEST_QEMU_IMG");