s3: torture: Fix return values
authorRikard Falkeborn <rikard.falkeborn@gmail.com>
Thu, 16 May 2019 19:43:46 +0000 (21:43 +0200)
committerJeremy Allison <jra@samba.org>
Sun, 19 May 2019 18:48:01 +0000 (18:48 +0000)
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 <rikard.falkeborn@gmail.com>
Reviewed-by: Ralph Böhme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sun May 19 18:48:01 UTC 2019 on sn-devel-184

source3/torture/test_addrchange.c

index daf0488aa18a15e3a6f0cd1e8592fd25ac4b37e2..9ccca1c6c5194ca04ec1d78e85b49954e22c318f 100644 (file)
@@ -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;
 }