All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libxl: fixup error handling in libxl_send_trigger
@ 2012-04-04  9:51 Ian Campbell
  2012-04-04 15:10 ` Ian Jackson
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Campbell @ 2012-04-04  9:51 UTC (permalink / raw)
  To: xen-devel; +Cc: ian.jackson

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# 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@citrix.com>

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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libxl: fixup error handling in libxl_send_trigger
  2012-04-04  9:51 [PATCH] libxl: fixup error handling in libxl_send_trigger Ian Campbell
@ 2012-04-04 15:10 ` Ian Jackson
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Jackson @ 2012-04-04 15:10 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel

Ian Campbell writes ("[PATCH] libxl: fixup error handling in libxl_send_trigger"):
> libxl: fixup error handling in libxl_send_trigger

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-04 15:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-04  9:51 [PATCH] libxl: fixup error handling in libxl_send_trigger Ian Campbell
2012-04-04 15:10 ` Ian Jackson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.