]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Resolve Coverity CHECKED_RETURN
authorJohn Ferlan <jferlan@redhat.com>
Fri, 12 Sep 2014 12:16:07 +0000 (08:16 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 15 Sep 2014 14:44:27 +0000 (10:44 -0400)
Coverity complained that checking the return of virDomainCreate()
was not consistent amongst the callers - so added the return check
to the objecteventtest.c and adjust the virt-login-shell to compare
< 0 rather than just non zero for the failure condition.

tests/objecteventtest.c
tools/virt-login-shell.c

index 919f559e1f31706eff43745db4c044452b489af3..052dbe539160618ac3b7e5208efa564054aef2b0 100644 (file)
@@ -359,7 +359,8 @@ testDomainStartStopEvent(const void *data)
 
     /* Test domain is started */
     virDomainDestroy(dom);
-    virDomainCreate(dom);
+    if (virDomainCreate(dom) < 0)
+        goto cleanup;
 
     if (virEventRunDefaultImpl() < 0)
         goto cleanup;
index be15a32c91005e9ae0f1a1a95e872943265dca48..ceb271d070f9affdc7175b738ab77d09390773ca 100644 (file)
@@ -275,7 +275,7 @@ main(int argc, char **argv)
     if (!dom)
         goto cleanup;
 
-    if (!virDomainIsActive(dom) && virDomainCreate(dom)) {
+    if (!virDomainIsActive(dom) && virDomainCreate(dom) < 0) {
         virErrorPtr last_error;
         last_error = virGetLastError();
         if (last_error->code != VIR_ERR_OPERATION_INVALID) {