1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

tests: Return failure if log not fopen'd

If @log is not fopen'd then, going to cleanup and calling fclose
will make for an unhappy callee. So just fail immediately instead
since there's nothing to clean up.

Found by Coverity

Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
John Ferlan 2018-04-02 07:13:33 -04:00
parent 4f995eab83
commit 713342e953

View File

@ -67,7 +67,7 @@ int main(int argc, char **argv) {
int ret = EXIT_FAILURE; int ret = EXIT_FAILURE;
if (!log) if (!log)
goto cleanup; return ret;
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++)
fprintf(log, "ARG:%s\n", argv[i]); fprintf(log, "ARG:%s\n", argv[i]);