mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Fix the return value in udevKludgeStorageType
Since the switch to VIR_STRDUP this function returns 1 on success, but the caller treats any non-zero value as failure.
This commit is contained in:
parent
df7291c31c
commit
4ccf6886c8
@ -939,28 +939,22 @@ static int udevProcessSD(struct udev_device *device,
|
|||||||
* storage device it is from other information that is provided. */
|
* storage device it is from other information that is provided. */
|
||||||
static int udevKludgeStorageType(virNodeDeviceDefPtr def)
|
static int udevKludgeStorageType(virNodeDeviceDefPtr def)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
VIR_DEBUG("Could not find definitive storage type for device "
|
VIR_DEBUG("Could not find definitive storage type for device "
|
||||||
"with sysfs path '%s', trying to guess it",
|
"with sysfs path '%s', trying to guess it",
|
||||||
def->sysfs_path);
|
def->sysfs_path);
|
||||||
|
|
||||||
if (STRPREFIX(def->caps->data.storage.block, "/dev/vd")) {
|
/* virtio disk */
|
||||||
/* virtio disk */
|
if (STRPREFIX(def->caps->data.storage.block, "/dev/vd") &&
|
||||||
ret = VIR_STRDUP(def->caps->data.storage.drive_type, "disk");
|
VIR_STRDUP(def->caps->data.storage.drive_type, "disk") > 0) {
|
||||||
}
|
|
||||||
|
|
||||||
if (ret != 0) {
|
|
||||||
VIR_DEBUG("Could not determine storage type for device "
|
|
||||||
"with sysfs path '%s'", def->sysfs_path);
|
|
||||||
} else {
|
|
||||||
VIR_DEBUG("Found storage type '%s' for device "
|
VIR_DEBUG("Found storage type '%s' for device "
|
||||||
"with sysfs path '%s'",
|
"with sysfs path '%s'",
|
||||||
def->caps->data.storage.drive_type,
|
def->caps->data.storage.drive_type,
|
||||||
def->sysfs_path);
|
def->sysfs_path);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
VIR_DEBUG("Could not determine storage type "
|
||||||
return ret;
|
"for device with sysfs path '%s'", def->sysfs_path);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user