Even if an error is reported by `udev_enumerate_scan_devices`,
e.g. because a driver of a device has an bug, we can still enumerate
all other devices. Additionally the documentation of
udev_enumerate_scan_devices says that on success an integer >= 0 is
returned (see man udev_enumerate_scan_devices(3)).
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
if (udevEnumerateAddMatches(udev_enumerate) < 0)
goto cleanup;
- ret = udev_enumerate_scan_devices(udev_enumerate);
- if (ret != 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("udev scan devices returned %d"),
- ret);
- goto cleanup;
- }
+ if (udev_enumerate_scan_devices(udev_enumerate) < 0)
+ VIR_WARN("udev scan devices failed");
udev_list_entry_foreach(list_entry,
udev_enumerate_get_list_entry(udev_enumerate)) {
udevProcessDeviceListEntry(udev, list_entry);
}
+ ret = 0;
cleanup:
udev_enumerate_unref(udev_enumerate);
return ret;