From: John Ferlan Date: Mon, 2 Apr 2018 11:13:33 +0000 (-0400) Subject: tests: Return failure if log not fopen'd X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=713342e9531581183dbf85fffcca4fea1ff80d02;p=libvirt.git 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 --- diff --git a/tests/commandhelper.c b/tests/commandhelper.c index 1da2834aa4..bf91550ede 100644 --- a/tests/commandhelper.c +++ b/tests/commandhelper.c @@ -67,7 +67,7 @@ int main(int argc, char **argv) { int ret = EXIT_FAILURE; if (!log) - goto cleanup; + return ret; for (i = 1; i < argc; i++) fprintf(log, "ARG:%s\n", argv[i]);