>From ef2efc11744f232ad0cc2ec31a505deadb871418 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Fri, 16 Oct 2009 13:53:08 +0100 Subject: [PATCH 1/2] vm-dump-metrics: Fix segmentation fault if Xenstore does not exist. Running vm-dump-metrics when there is no metrics disk *and* no Xen / Xenstore, causes a segmentation fault because of an unchecked call to xs_domain_open. Reported to Red Hat as: https://bugzilla.redhat.com/show_bug.cgi?id=529348 --- libmetrics/libmetrics.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/libmetrics/libmetrics.c b/libmetrics/libmetrics.c index 9b3f9fa..8aaabcb 100644 --- a/libmetrics/libmetrics.c +++ b/libmetrics/libmetrics.c @@ -466,6 +466,10 @@ static int get_dom_id() unsigned int len; xsh = xs_domain_open(); + if (xsh == NULL) { + libmsg("xs_domain_open: cannot open xenstore\n"); + return -1; + } domid = xs_read(xsh, XBT_NULL, "domid", &len); if (domid) { domID = atoi(domid); -- 1.6.5.rc2