mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-07 09:19:19 +00:00
virsh: introduce 'ret' in cmdDomFSInfo
Failing to print the table is also a reason to return failure and print the reported error. Switch to the usual pattern where we fall through the cleanup label right after setting ret to true instead of infering the return value from the number of filesystems returned. Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
eb3f5a2c6d
commit
023f0672d4
@ -13941,6 +13941,7 @@ cmdDomFSInfo(vshControl *ctl, const vshCmd *cmd)
|
|||||||
virDomainFSInfoPtr *info = NULL;
|
virDomainFSInfoPtr *info = NULL;
|
||||||
vshTablePtr table = NULL;
|
vshTablePtr table = NULL;
|
||||||
size_t ninfos = 0;
|
size_t ninfos = 0;
|
||||||
|
bool ret = false;
|
||||||
|
|
||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
@ -13953,6 +13954,7 @@ cmdDomFSInfo(vshControl *ctl, const vshCmd *cmd)
|
|||||||
ninfos = rc;
|
ninfos = rc;
|
||||||
|
|
||||||
if (ninfos == 0) {
|
if (ninfos == 0) {
|
||||||
|
ret = true;
|
||||||
vshError(ctl, _("No filesystems are mounted in the domain"));
|
vshError(ctl, _("No filesystems are mounted in the domain"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -13986,6 +13988,8 @@ cmdDomFSInfo(vshControl *ctl, const vshCmd *cmd)
|
|||||||
vshTablePrintToStdout(table, ctl);
|
vshTablePrintToStdout(table, ctl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = true;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (info) {
|
if (info) {
|
||||||
for (i = 0; i < ninfos; i++)
|
for (i = 0; i < ninfos; i++)
|
||||||
@ -13994,7 +13998,7 @@ cmdDomFSInfo(vshControl *ctl, const vshCmd *cmd)
|
|||||||
}
|
}
|
||||||
vshTableFree(table);
|
vshTableFree(table);
|
||||||
virshDomainFree(dom);
|
virshDomainFree(dom);
|
||||||
return rc >= 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
const vshCmdDef domManagementCmds[] = {
|
const vshCmdDef domManagementCmds[] = {
|
||||||
|
Loading…
Reference in New Issue
Block a user