提交 96e5c417 编写于 作者: M Michal Privoznik

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: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NPavel Hrdina <phrdina@redhat.com>
上级 25e2e4e0
......@@ -605,22 +605,16 @@ static int
virStorageBackendISCSIDirectGetLun(virStorageVolDefPtr vol,
int *lun)
{
const char *name = vol->name;
int ret = -1;
const char *name;
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,
_("Invalid volume name %s"), name);
goto cleanup;
_("Invalid volume name %s"), vol->name);
return -1;
}
name += strlen(VOL_NAME_PREFIX);
if (virStrToLong_i(name, NULL, 10, lun) < 0)
goto cleanup;
ret = 0;
cleanup:
return ret;
return 0;
}
static int
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册