From 227ed26614b5747cc5b73d7b922c112a1f623949 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Fri, 12 Nov 2010 15:51:14 +0000 Subject: [PATCH] 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 --- tools/virsh.c | 6 ++++++ 1 file changed, 6 insertions(+) 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));