提交 3775a2e1 编写于 作者: J Ján Tomko

udevProcessSCSIHost: use STRSKIP

Instead of separating it into STRPEFIX and str + strlen.
上级 170c68c4
...@@ -712,16 +712,17 @@ static int udevProcessSCSIHost(struct udev_device *device ATTRIBUTE_UNUSED, ...@@ -712,16 +712,17 @@ static int udevProcessSCSIHost(struct udev_device *device ATTRIBUTE_UNUSED,
int ret = -1; int ret = -1;
virNodeDevCapDataPtr data = &def->caps->data; virNodeDevCapDataPtr data = &def->caps->data;
char *filename = NULL; char *filename = NULL;
char *str;
filename = last_component(def->sysfs_path); filename = last_component(def->sysfs_path);
if (!STRPREFIX(filename, "host")) { if (!(str = STRSKIP(filename, "host"))) {
VIR_ERROR(_("SCSI host found, but its udev name '%s' does " VIR_ERROR(_("SCSI host found, but its udev name '%s' does "
"not begin with 'host'"), filename); "not begin with 'host'"), filename);
goto out; goto out;
} }
if (udevStrToLong_ui(filename + strlen("host"), if (udevStrToLong_ui(str,
NULL, NULL,
0, 0,
&data->scsi_host.host) == -1) { &data->scsi_host.host) == -1) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册