]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
src: Check for virDomainDiskInsert() retval properly
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 26 Apr 2019 13:14:17 +0000 (15:14 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 26 Apr 2019 13:14:17 +0000 (15:14 +0200)
Our coding style specifies that only negative values are considered as
error. Check for return value of virDomainDiskInsert() properly,
following the style. Not that the function can now return anything other
than 0 or -1, but it just triggers my OCD.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/libxl/libxl_driver.c
src/lxc/lxc_driver.c
src/qemu/qemu_driver.c

index 42221cb925d341e13ee80813604beb220c804b35..e7234c147926109322c6e2d5bb9d5fe10d784ae6 100644 (file)
@@ -3517,7 +3517,7 @@ libxlDomainAttachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev)
                                _("target %s already exists."), disk->dst);
                 return -1;
             }
-            if (virDomainDiskInsert(vmdef, disk))
+            if (virDomainDiskInsert(vmdef, disk) < 0)
                 return -1;
             /* vmdef has the pointer. Generic codes for vmdef will do all jobs */
             dev->data.disk = NULL;
index 37002dbf2385dc13ea7b009eaea6cf589bfcd562..fbdd33156a139469a5cba90e7d0e2610eb512d30 100644 (file)
@@ -3417,7 +3417,7 @@ lxcDomainAttachDeviceConfig(virDomainDefPtr vmdef,
                            _("target %s already exists."), disk->dst);
             return -1;
         }
-        if (virDomainDiskInsert(vmdef, disk))
+        if (virDomainDiskInsert(vmdef, disk) < 0)
             return -1;
         /* vmdef has the pointer. Generic codes for vmdef will do all jobs */
         dev->data.disk = NULL;
index f48d9256e4cc0f6282dcd7aa13bb7a1b53508eb3..30fc335883a410dce8de4a1d0446f2e72721d251 100644 (file)
@@ -8144,7 +8144,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
             return -1;
         if (qemuCheckDiskConfig(disk, NULL) < 0)
             return -1;
-        if (virDomainDiskInsert(vmdef, disk))
+        if (virDomainDiskInsert(vmdef, disk) < 0)
             return -1;
         /* vmdef has the pointer. Generic codes for vmdef will do all jobs */
         dev->data.disk = NULL;