From: Ian Campbell Subject: Re: [PATCH 16/29] libxl: check for xc_domain_shutdown failure in libxl__domain_suspend_common_callback Date: Thu, 31 Oct 2013 21:36:07 +0000 Message-ID: <1383255367.5436.148.camel@dagon.hellion.org.uk> References: <1383119525-26033-1-git-send-email-mattjd@gmail.com> <1383119525-26033-17-git-send-email-mattjd@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1383119525-26033-17-git-send-email-mattjd@gmail.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: Matthew Daley Cc: Stefano Stabellini , Ian Jackson , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Wed, 2013-10-30 at 20:51 +1300, Matthew Daley wrote: > Coverity-ID: 1055048 > Signed-off-by: Matthew Daley > --- > tools/libxl/libxl_dom.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c > index 5b9fd27..4606a12 100644 > --- a/tools/libxl/libxl_dom.c > +++ b/tools/libxl/libxl_dom.c > @@ -1041,7 +1041,11 @@ int libxl__domain_suspend_common_callback(void *user) > > if (dss->hvm && (!hvm_pvdrv || hvm_s_state)) { > LOG(DEBUG, "Calling xc_domain_shutdown on HVM domain"); > - xc_domain_shutdown(CTX->xch, domid, SHUTDOWN_suspend); > + ret = xc_domain_shutdown(CTX->xch, domid, SHUTDOWN_suspend); > + if (ret < 0) { > + LOG(ERROR, "xc_domain_shutdown failed ret=%d", ret); This returns -1 and sets errno I think, if so then ret is largely uninteresting. If you want to print errno you can use LOGE() and if ret really was an errno val then LOGEV() will do the right thing, I think. > + return 0; > + } > /* The guest does not (need to) respond to this sort of request. */ > dss->guest_responded = 1; > } else {