const char *str = NULL;
str = udevGetDeviceProperty(udev_device, property_key);
+ if (!str) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing udev property '%s' on '%s'"),
+ property_key, udev_device_get_sysname(udev_device));
+ return -1;
+ }
- if (str && virStrToLong_i(str, NULL, base, value) < 0) {
+ if (virStrToLong_i(str, NULL, base, value) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to convert '%s' to int"), str);
+ _("Failed to parse int '%s' from udev property '%s' on '%s'"),
+ str, property_key, udev_device_get_sysname(udev_device));
return -1;
}
return 0;
const char *str = NULL;
str = udevGetDeviceProperty(udev_device, property_key);
+ if (!str) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Missing udev property '%s' on '%s'"),
+ property_key, udev_device_get_sysname(udev_device));
+ return -1;
+ }
- if (str && virStrToLong_ui(str, NULL, base, value) < 0) {
+ if (virStrToLong_ui(str, NULL, base, value) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to convert '%s' to int"), str);
+ _("Failed to parse uint '%s' from udev property '%s' on '%s'"),
+ str, property_key, udev_device_get_sysname(udev_device));
return -1;
}
return 0;