From: Daniel P. Berrange Date: Fri, 12 Nov 2010 15:51:14 +0000 (+0000) Subject: Fix error handling in virsh when listing storage volumes X-Git-Tag: v0.8.6~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=227ed26614b5747cc5b73d7b922c112a1f623949;p=thirdparty%2Flibvirt.git 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 --- diff --git a/tools/virsh.c b/tools/virsh.c index 78a5c5b4ab..0ea1930e4b 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -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));