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

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



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1333552218 -3600
# Node ID edbfed5c33897abb9ed29a7cbb03b44526424cad
# Parent  1687cd2e97e37972034f77d9952d10e9b52ac8a4
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>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r 1687cd2e97e3 -r edbfed5c3389 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Wed Apr 04 16:06:42 2012 +0100
+++ b/tools/libxl/libxl.c       Wed Apr 04 16:10:18 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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
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®.