]> xenbits.xensource.com Git - libvirt.git/commitdiff
libxl: Resolve Coverity CHECKED_RETURN
authorJohn Ferlan <jferlan@redhat.com>
Mon, 1 Dec 2014 16:10:18 +0000 (11:10 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 1 Dec 2014 16:21:32 +0000 (11:21 -0500)
Commit id 'cb88d433' refactored the calling sequence to use a thread;
however, in doing so "lost" the check for if virNetSocketAccept returns
failure.  Since other code makes that check, Coverity complains. Although
a false positive, adding back the failure check pacifies Coverity

src/libxl/libxl_migration.c

index 0caa3d0734bba207042ad9d7b0a5092fbd62f013..4db89b63d79308a0e5f723df2da1ff2021b3df8e 100644 (file)
@@ -133,8 +133,7 @@ libxlMigrateReceive(virNetSocketPtr sock,
     size_t i;
 
     /* Accept migration connection */
-    virNetSocketAccept(sock, &client_sock);
-    if (client_sock == NULL) {
+    if (virNetSocketAccept(sock, &client_sock) < 0 || !client_sock) {
         virReportError(VIR_ERR_OPERATION_FAILED, "%s",
                        _("Failed to accept migration connection"));
         goto fail;