mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-06 17:03:49 +00:00
virsh: introduce ninfos variable in cmdDomFSInfo
Do not use 'ret' throughout the whole function to avoid confusion and comparison of unsigned 'i' against signed 'ret'. Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
b419ea6a90
commit
443fc056a0
@ -13940,6 +13940,7 @@ cmdDomFSInfo(vshControl *ctl, const vshCmd *cmd)
|
|||||||
size_t i, j;
|
size_t i, j;
|
||||||
virDomainFSInfoPtr *info;
|
virDomainFSInfoPtr *info;
|
||||||
vshTablePtr table = NULL;
|
vshTablePtr table = NULL;
|
||||||
|
size_t ninfos = 0;
|
||||||
|
|
||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
@ -13949,7 +13950,9 @@ cmdDomFSInfo(vshControl *ctl, const vshCmd *cmd)
|
|||||||
vshError(ctl, _("Unable to get filesystem information"));
|
vshError(ctl, _("Unable to get filesystem information"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (ret == 0) {
|
ninfos = ret;
|
||||||
|
|
||||||
|
if (ninfos == 0) {
|
||||||
vshError(ctl, _("No filesystems are mounted in the domain"));
|
vshError(ctl, _("No filesystems are mounted in the domain"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -13959,7 +13962,7 @@ cmdDomFSInfo(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!table)
|
if (!table)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
for (i = 0; i < ret; i++) {
|
for (i = 0; i < ninfos; i++) {
|
||||||
virBuffer targetsBuff = VIR_BUFFER_INITIALIZER;
|
virBuffer targetsBuff = VIR_BUFFER_INITIALIZER;
|
||||||
VIR_AUTOFREE(char *) targets = NULL;
|
VIR_AUTOFREE(char *) targets = NULL;
|
||||||
|
|
||||||
@ -13985,7 +13988,7 @@ cmdDomFSInfo(vshControl *ctl, const vshCmd *cmd)
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (info) {
|
if (info) {
|
||||||
for (i = 0; i < ret; i++)
|
for (i = 0; i < ninfos; i++)
|
||||||
virDomainFSInfoFree(info[i]);
|
virDomainFSInfoFree(info[i]);
|
||||||
VIR_FREE(info);
|
VIR_FREE(info);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user