From: Michal Privoznik Date: Fri, 26 Apr 2019 13:14:17 +0000 (+0200) Subject: src: Check for virDomainDiskInsert() retval properly X-Git-Tag: v5.3.0-rc2~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=08193fdbf543e4034413f3757c2eac81ce05d53d;p=thirdparty%2Flibvirt.git src: Check for virDomainDiskInsert() retval properly 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 --- diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 42221cb925..e7234c1479 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -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; diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 37002dbf23..fbdd33156a 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -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; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f48d9256e4..30fc335883 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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;