From: Wei Liu Subject: Re: [PATCH 1/4] libxenstat: check xc_interface_open return value Date: Wed, 8 Apr 2015 16:47:14 +0100 Message-ID: <20150408154714.GK30811@zion.uk.xensource.com> References: <1428505275-6563-1-git-send-email-wei.liu2@citrix.com> <1428505275-6563-2-git-send-email-wei.liu2@citrix.com> <55254794.2020806@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <55254794.2020806@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Charles Arnold , Ian Jackson , Wei Liu , Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Wed, Apr 08, 2015 at 04:21:56PM +0100, Andrew Cooper wrote: > On 08/04/15 16:01, Wei Liu wrote: > > Signed-off-by: Wei Liu > > Cc: Ian Campbell > > Cc: Ian Jackson > > Cc: Charles Arnold > > The xenstat handle passed around already has an open xc_handle. That > should be reused rather than opening a new one every time we want to get > a list of domain ids. > Yes, you're right. I will use that. Wei. > ~Andrew > > > --- > > tools/xenstat/libxenstat/src/xenstat_qmp.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/tools/xenstat/libxenstat/src/xenstat_qmp.c b/tools/xenstat/libxenstat/src/xenstat_qmp.c > > index 2cb99e9..f3aeec4 100644 > > --- a/tools/xenstat/libxenstat/src/xenstat_qmp.c > > +++ b/tools/xenstat/libxenstat/src/xenstat_qmp.c > > @@ -366,6 +366,8 @@ static xc_domaininfo_t *get_domain_ids(int *num_doms) > > if (dominfo == NULL) > > return NULL; > > xc_handle = xc_interface_open(0,0,0); > > + if (xc_handle == NULL) > > + return NULL; > > *num_doms = xc_domain_getinfolist(xc_handle, 0, 1024, dominfo); > > xc_interface_close(xc_handle); > > return dominfo;