[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] libxl: fixup error handling in libxl__build_hvm.



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1306258007 -3600
# Node ID a49b166232ec1b0916db897764bed76c453ea0a8
# Parent  fab5ae42dd439a1ed6d7294a0b13dc0729544c1b
libxl: fixup error handling in libxl__build_hvm.

We first pointless initialise rc and immediately overwrite the value, then fail
to return it on error anyway...

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r fab5ae42dd43 -r a49b166232ec tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c   Tue May 24 18:25:56 2011 +0100
+++ b/tools/libxl/libxl_dom.c   Tue May 24 18:26:47 2011 +0100
@@ -284,15 +284,17 @@
               libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
-    int ret, rc = ERROR_INVAL;
+    int ret, rc = ERROR_FAIL;
+    const char *firmware = libxl__domain_firmware(gc, info, dm_info);
 
-    rc = ERROR_FAIL;
+    if (!firmware)
+        goto out;
     ret = xc_hvm_build_target_mem(
         ctx->xch,
         domid,
         (info->max_memkb - info->video_memkb) / 1024,
         (info->target_memkb - info->video_memkb) / 1024,
-        libxl__domain_firmware(gc, info, dm_info));
+        firmware);
     if (ret) {
         LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, ret, "hvm building failed");
         goto out;
@@ -305,7 +307,7 @@
     }
     rc = 0;
 out:
-    return 0;
+    return rc;
 }
 
 int libxl__domain_restore_common(libxl__gc *gc, uint32_t domid,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.