]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: Return failure if log not fopen'd
authorJohn Ferlan <jferlan@redhat.com>
Mon, 2 Apr 2018 11:13:33 +0000 (07:13 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 19 Apr 2018 18:24:12 +0000 (14:24 -0400)
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>
tests/commandhelper.c

index 1da2834aa4ef2ab90047221edf7c68b0f086bd66..bf91550ede22a25b7168b5df3e49b9ea378299ca 100644 (file)
@@ -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]);