libxl: fixup error handling in libxl_send_trigger
PATCH 1/1 libxl: fixup error handling in libxl_send_trigger
# HG changeset patch
# User Ian Campbell <[email protected]> # 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 <[email protected]>
tools/libxl/libxl.c +6 -5
@@ -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 Campbell writes ("[PATCH] libxl: fixup error handling in libxl_send_trigger"):
Quoted 1 line
libxl: fixup error handling in
libxl_send_trigger
Acked-by Ian Jackson <[email protected]>
Committed-by Ian Jackson <[email protected]>