From: Konrad Rzeszutek Wilk Subject: [PATCH RFC 13/14] libxl: Don't assign return value to errno for E820 get/set xc_ calls. Date: Fri, 13 Mar 2015 15:31:22 -0400 Message-ID: <1426275083-8454-14-git-send-email-konrad.wilk@oracle.com> References: <1426275083-8454-1-git-send-email-konrad.wilk@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YWVJQ-0006l6-Ai for xen-devel@lists.xenproject.org; Fri, 13 Mar 2015 19:32:00 +0000 In-Reply-To: <1426275083-8454-1-git-send-email-konrad.wilk@oracle.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: xen-devel@lists.xenproject.org, ian.jackson@eu.citrix.com, stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, wei.liu2@citrix.com Cc: Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org We should be using the errno that the hypercall left instead of overwritting it with the return value. Signed-off-by: Konrad Rzeszutek Wilk --- tools/libxl/libxl_x86.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c index 9ceb373..fe2ff10 100644 --- a/tools/libxl/libxl_x86.c +++ b/tools/libxl/libxl_x86.c @@ -224,10 +224,9 @@ static int libxl__e820_alloc(libxl__gc *gc, uint32_t domid, return ERROR_INVAL; rc = xc_get_machine_memory_map(ctx->xch, map, E820MAX); - if (rc < 0) { - errno = rc; + if (rc < 0) return ERROR_FAIL; - } + nr = rc; rc = e820_sanitize(ctx, map, &nr, b_info->target_memkb, (b_info->max_memkb - b_info->target_memkb) + @@ -237,10 +236,8 @@ static int libxl__e820_alloc(libxl__gc *gc, uint32_t domid, rc = xc_domain_set_memory_map(ctx->xch, domid, map, nr); - if (rc < 0) { - errno = rc; + if (rc < 0) return ERROR_FAIL; - } return 0; } -- 2.1.0