libxl: Don't assign return value to errno for E820 get/set xc_ calls
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 19 Mar 2015 00:24:18 +0000 (20:24 -0400)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 20 Mar 2015 16:07:58 +0000 (16:07 +0000)
We should be using the errno that the hypercall left
instead of overwriting it with the return value.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxl_x86.c

index fd45ead2d6de738e071917086373f1901faef7e5..376b477af7f629a36dfc50ac9569a3ff3bb34c8f 100644 (file)
@@ -215,10 +215,8 @@ static int e820_host_sanitize(libxl__gc *gc,
     int rc;
 
     rc = xc_get_machine_memory_map(CTX->xch, map, *nr);
-    if (rc < 0) {
-        errno = rc;
+    if (rc < 0)
         return ERROR_FAIL;
-    }
 
     *nr = rc;
 
@@ -251,10 +249,9 @@ 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;
 }