From: Ian Jackson Subject: Re: [PATCH 4/4 v2] tools/xc: pass errno to callers of xc_domain_save Date: Mon, 10 Mar 2014 16:59:33 +0000 Message-ID: <21277.61301.269725.74179@mariner.uk.xensource.com> References: <1394183709-9956-1-git-send-email-olaf@aepfle.de> <1394183709-9956-5-git-send-email-olaf@aepfle.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1394183709-9956-5-git-send-email-olaf@aepfle.de> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Olaf Hering Cc: Ian.Campbell@citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Olaf Hering writes ("[PATCH 4/4 v2] tools/xc: pass errno to callers of xc_domain_save"): > @@ -914,13 +915,13 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter > &ctx->max_mfn, &ctx->hvirt_start, &ctx->pt_levels, &dinfo->guest_width) ) > { > ERROR("Unable to get platform info."); > - return 1; > + goto exit; This all looks pretty good, thanks. Can I suggest that these cases could probably benefit from assert(errno) ? That way there is no risk of thinking we have succeeded because some subfunction with poor error handling has failed but not set errno. One option for doing centrally would be: > /* Success! */ - - rc = 0; - + errno = 0; + goto out_rc; > out: > + rc = errno; + assert(rc); + out_rc: > completed = 1; Thanks, Ian.