Ian Campbell
2012-Apr-04 09:51 UTC
[PATCH] libxl: fixup error handling in libxl_send_trigger
# 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)
Ian Jackson
2012-Apr-04 15:10 UTC
Re: [PATCH] libxl: fixup error handling in libxl_send_trigger
Ian Campbell writes ("[PATCH] libxl: fixup error handling in libxl_send_trigger"):> libxl: fixup error handling in libxl_send_triggerAcked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>