From 6e2a53afa15422ee290663dbb798c085ef7068ed Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Mon, 23 Jul 2018 11:26:49 +0100 Subject: [PATCH] ocaml: remove undefined behaviour in systemd_stubs.c Clang complains: systemd_stubs.c:51:8: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] ret = Val_int(-1U); ^~~~~~~~~~~~ Since sd_notify_fd has a signature of unit -> unit, we simply change the return value to Val_unit. Signed-off-by: Wei Liu Acked-by: Christian Lindig Acked-by: Andrew Cooper --- tools/ocaml/xenstored/systemd_stubs.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tools/ocaml/xenstored/systemd_stubs.c b/tools/ocaml/xenstored/systemd_stubs.c index 490156c06a..31a1a5d384 100644 --- a/tools/ocaml/xenstored/systemd_stubs.c +++ b/tools/ocaml/xenstored/systemd_stubs.c @@ -32,13 +32,10 @@ CAMLprim value ocaml_sd_notify_ready(value ignore) { CAMLparam1(ignore); - CAMLlocal1(ret); - - ret = Val_int(0); sd_notify(1, "READY=1"); - CAMLreturn(ret); + CAMLreturn(Val_unit); } #else @@ -46,10 +43,7 @@ CAMLprim value ocaml_sd_notify_ready(value ignore) CAMLprim value ocaml_sd_notify_ready(value ignore) { CAMLparam1(ignore); - CAMLlocal1(ret); - - ret = Val_int(-1U); - CAMLreturn(ret); + CAMLreturn(Val_unit); } #endif -- 2.30.2