mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
iscsi_direct: Make virStorageBackendISCSIDirectGetLun report error properly
This function reports error for one of the two error paths. This is unfortunate as a caller see this function failing but doesn't know right away if an error was reported. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
25e2e4e04f
commit
96e5c4177e
@ -605,22 +605,16 @@ static int
|
|||||||
virStorageBackendISCSIDirectGetLun(virStorageVolDefPtr vol,
|
virStorageBackendISCSIDirectGetLun(virStorageVolDefPtr vol,
|
||||||
int *lun)
|
int *lun)
|
||||||
{
|
{
|
||||||
const char *name = vol->name;
|
const char *name;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
if (!STRPREFIX(name, VOL_NAME_PREFIX)) {
|
if (!(name = STRSKIP(vol->name, VOL_NAME_PREFIX)) ||
|
||||||
|
virStrToLong_i(name, NULL, 10, lun) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Invalid volume name %s"), name);
|
_("Invalid volume name %s"), vol->name);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
name += strlen(VOL_NAME_PREFIX);
|
return 0;
|
||||||
if (virStrToLong_i(name, NULL, 10, lun) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
ret = 0;
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
Reference in New Issue
Block a user