From: Rikard Falkeborn Date: Thu, 16 May 2019 19:43:46 +0000 (+0200) Subject: s3: torture: Fix return values X-Git-Tag: ldb-2.0.5~763 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=594676c8b8f9138c013871a5da01fca67e1aa282;p=thirdparty%2Fsamba.git s3: torture: Fix return values Torture tests should return true on success and false on failure. Returning -1 is the same as returning true and returning 0 is the same as returning false. Change the return values to true and false to fix the return values. Detected by the help of cppcheck. Signed-off-by: Rikard Falkeborn Reviewed-by: Ralph Böhme Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Sun May 19 18:48:01 UTC 2019 on sn-devel-184 --- diff --git a/source3/torture/test_addrchange.c b/source3/torture/test_addrchange.c index daf0488aa18..9ccca1c6c51 100644 --- a/source3/torture/test_addrchange.c +++ b/source3/torture/test_addrchange.c @@ -34,7 +34,7 @@ bool run_addrchange(int dummy) ev = samba_tevent_context_init(talloc_tos()); if (ev == NULL) { d_fprintf(stderr, "tevent_context_init failed\n"); - return -1; + return false; } status = addrchange_context_create(talloc_tos(), &ctx); @@ -54,14 +54,14 @@ bool run_addrchange(int dummy) req = addrchange_send(talloc_tos(), ev, ctx); if (req == NULL) { d_fprintf(stderr, "addrchange_send failed\n"); - return -1; + return false; } if (!tevent_req_poll_ntstatus(req, ev, &status)) { d_fprintf(stderr, "tevent_req_poll_ntstatus failed: " "%s\n", nt_errstr(status)); TALLOC_FREE(req); - return -1; + return false; } status = addrchange_recv(req, &type, &addr); @@ -69,7 +69,7 @@ bool run_addrchange(int dummy) if (!NT_STATUS_IS_OK(status)) { d_fprintf(stderr, "addrchange_recv failed: %s\n", nt_errstr(status)); - return -1; + return false; } switch(type) { @@ -90,5 +90,5 @@ bool run_addrchange(int dummy) } TALLOC_FREE(ctx); TALLOC_FREE(ev); - return 0; + return true; }