Fix error handling in virsh when listing storage volumes

virsh was not checking for a error code when listing storage
volumes. So when listing volumes in a pool that was shutoff,
no output was displayed

* tools/virsh.c: Fix error handling when listing volumes
This commit is contained in:
Daniel P. Berrange 2010-11-12 15:51:14 +00:00
parent 174d737d95
commit 227ed26614

View File

@ -6796,6 +6796,12 @@ cmdVolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
/* Determine the number of volumes in the pool */
numVolumes = virStoragePoolNumOfVolumes(pool);
if (numVolumes < 0) {
vshError(ctl, "%s", _("Failed to list storage volumes"));
virStoragePoolFree(pool);
return FALSE;
}
/* Retrieve the list of volume names in the pool */
if (numVolumes > 0) {
activeNames = vshCalloc(ctl, numVolumes, sizeof(*activeNames));