1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-25 01:34:11 +03:00

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: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
This commit is contained in:
Boris Fiuczynski 2013-09-30 14:23:17 +02:00 committed by Michal Privoznik
parent 0c500a4f2e
commit 11d9dd7ba0

View File

@ -88,16 +88,13 @@ static int
virSCSIDeviceGetAdapterId(const char *adapter,
unsigned int *adapter_id)
{
if (STRPREFIX(adapter, "scsi_host")) {
if (virStrToLong_ui(adapter + strlen("scsi_host"),
NULL, 0, adapter_id) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Cannot parse adapter '%s'"), adapter);
return -1;
}
}
return 0;
if (STRPREFIX(adapter, "scsi_host") &&
virStrToLong_ui(adapter + strlen("scsi_host"),
NULL, 0, adapter_id) == 0)
return 0;
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Cannot parse adapter '%s'"), adapter);
return -1;
}
char *