]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: Fix error path in virSCSIVHostOpenVhostSCSI
authorJohn Ferlan <jferlan@redhat.com>
Tue, 12 Dec 2017 13:33:48 +0000 (08:33 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 13 Dec 2017 20:37:30 +0000 (15:37 -0500)
We cannot be sure someone initialized the passed *vhostfd and we
certainly don't want or need to be calling VIR_FORCE_CLOSE on what
probably is -1. So let's just return -1 immediately.

src/util/virscsivhost.c

index dc7df757a1b6eb1620f7c608044e74a112e28cfa..d6fbf5ed5b213ccb603a1c64ce09cedc4a0c345b 100644 (file)
@@ -87,7 +87,7 @@ int
 virSCSIVHostOpenVhostSCSI(int *vhostfd)
 {
     if (!virFileExists(VHOST_SCSI_DEVICE))
-        goto error;
+        return -1;
 
     *vhostfd = open(VHOST_SCSI_DEVICE, O_RDWR);