From: Daniel P. Berrange Date: Mon, 21 Aug 2006 17:58:09 +0000 (+0000) Subject: Check for failure of virConnectListDomains in 'list' command X-Git-Tag: LIBVIRT_0_1_6~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0658b086cdcc6377ab58fa25167cc013a0fb3e7a;p=thirdparty%2Flibvirt.git Check for failure of virConnectListDomains in 'list' command --- diff --git a/ChangeLog b/ChangeLog index 5d8203e383..e1f5884c6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,10 @@ -Thu Aug 18 15:22:23 EDT 2006 Daniel Berrange +Mon Aug 21 13:00:03 EDT 2006 Daniel Berrange + + * src/virsh.c: check return code of virConnectListDomains in case + there was a failure, and stop the 'list' command immediately + rather than continuing with bogus domain ID data. + +Fri Aug 18 15:22:23 EDT 2006 Daniel Berrange * src/xml.c: fix networking in paravirt guests - only set the '(type ioemu)' option for HVM. diff --git a/src/virsh.c b/src/virsh.c index 75651d2b9e..5ccd0bd2b9 100644 --- a/src/virsh.c +++ b/src/virsh.c @@ -332,7 +332,10 @@ cmdList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) } ids = vshMalloc(ctl, sizeof(int) * maxid); - virConnectListDomains(ctl->conn, &ids[0], maxid); + if (virConnectListDomains(ctl->conn, &ids[0], maxid) < 0) { + vshError(ctl, FALSE, "failed to list active domains."); + return FALSE; + } vshPrintExtra(ctl, "%3s %-20s %s\n", "Id", "Name", "State"); vshPrintExtra(ctl, "----------------------------------\n");