提交 11d9dd7b 编写于 作者: B Boris Fiuczynski 提交者: Michal Privoznik

virscsi: hostdev SCSI AdapterId retrieval fix

Fixed the retrieval of the AdapterId from the AdapterName of the
hostdev source so it does return an error instead of leaving the
adapter_id uninitialized.
Signed-off-by: NBoris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
上级 0c500a4f
...@@ -88,16 +88,13 @@ static int ...@@ -88,16 +88,13 @@ static int
virSCSIDeviceGetAdapterId(const char *adapter, virSCSIDeviceGetAdapterId(const char *adapter,
unsigned int *adapter_id) unsigned int *adapter_id)
{ {
if (STRPREFIX(adapter, "scsi_host")) { if (STRPREFIX(adapter, "scsi_host") &&
if (virStrToLong_ui(adapter + strlen("scsi_host"), virStrToLong_ui(adapter + strlen("scsi_host"),
NULL, 0, adapter_id) < 0) { NULL, 0, adapter_id) == 0)
virReportError(VIR_ERR_INTERNAL_ERROR, return 0;
_("Cannot parse adapter '%s'"), adapter); virReportError(VIR_ERR_INTERNAL_ERROR,
return -1; _("Cannot parse adapter '%s'"), adapter);
} return -1;
}
return 0;
} }
char * char *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册