[PATCH] lib:util: Fix tfork return value if sigprocmask fails
Rikard Falkeborn
rikard.falkeborn at gmail.com
Sat May 11 19:31:44 UTC 2019
Returning a non-zero value from a function with bool as return value is
the same as returning true. Change the return value to false if
sigprocmask or pthread_sigmask fails to indicate failure.
Detected with the help of cppcheck.
There are a couple of similar issues in the source3 directory, I wasn't sure
if this directory is in use and if it's worth fixing these as well?
MR: https://gitlab.com/samba-team/samba/merge_requests/436
CI: https://gitlab.com/rikardfalkeborn/samba/pipelines/60596119
Please review.
-------------- next part --------------
From 79ab006598725010059aa93bd699017d14bd5cdc Mon Sep 17 00:00:00 2001
From: Rikard Falkeborn <rikard.falkeborn at gmail.com>
Date: Thu, 9 May 2019 21:17:24 +0200
Subject: [PATCH] lib:util: Fix tfork return value if sigprocmask fails
Returning a non-zero value from a function with bool as return value is
the same as returning true. Change the return value to false if
sigprocmask or pthread_sigmask fails to indicate failure.
Detected with the help of cppcheck.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn at gmail.com>
---
lib/util/tests/tfork.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/util/tests/tfork.c b/lib/util/tests/tfork.c
index ef3a6f717d0..8a6197fc00f 100644
--- a/lib/util/tests/tfork.c
+++ b/lib/util/tests/tfork.c
@@ -490,7 +490,7 @@ static bool test_tfork_threads(struct torture_context *tctx)
ret = sigprocmask(SIG_UNBLOCK, &set, NULL);
#endif
if (ret != 0) {
- return -1;
+ return false;
}
for (i = 0; i < num_threads; i++) {
--
2.21.0
More information about the samba-technical
mailing list