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

[Xen-devel] [PATCH] libxl: fixup error handling in libxl_send_trigger



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1333532948 -3600
# Node ID d00faeaf21dd280500d2deace00683d884a2dc10
# Parent  c99e16a24eabeb6d3ed9f961d35e84acf7cd8cdd
libxl: fixup error handling in libxl_send_trigger

xc_domain_send_trigger returns -1 and sets errno on failure so use
LIBXL__LOG_ERRNO not LIBXL__LOG_ERRNOVAL(rc).

Change the default case of the switch to set rc=-1,errno=EINVAL too.

Also we weren't actually returning the error code we'd decided on.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r c99e16a24eab -r d00faeaf21dd tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Wed Apr 04 10:37:18 2012 +0100
+++ b/tools/libxl/libxl.c       Wed Apr 04 10:49:08 2012 +0100
@@ -3309,18 +3309,19 @@ int libxl_send_trigger(libxl_ctx *ctx, u
         rc = 0;
         break;
     default:
-        rc = EINVAL;
+        rc = -1;
+        errno = EINVAL;
         break;
     }
 
     if (rc != 0) {
-        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
-                            "Send trigger '%s' failed",
-                            libxl_trigger_to_string(trigger));
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+                         "Send trigger '%s' failed",
+                         libxl_trigger_to_string(trigger));
         rc = ERROR_FAIL;
     }
 
-    return 0;
+    return rc;
 }
 
 int libxl_send_sysrq(libxl_ctx *ctx, uint32_t domid, char sysrq)

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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