tree-wide: use assert_se() for signal operations with constants

Continuation of a3ebe5eb62:
in other places we sometimes use assert_se(), and sometimes normal error
handling. sigfillset and sigaddset can only fail if mask is NULL (which cannot
happen if we are passing in a reference), or if the signal number is invalid
(which really shouldn't happen when we are using a constant like SIGCHLD. If
SIGCHLD is invalid, we have a bigger problem). So let's simplify things and
always use assert_se() in those cases.

In sigset_add_many() we could conceivably pass an invalid signal, so let's keep
normal error handling here. The caller can do assert_se() around the
sigprocmask_many() call if appropriate.

'>= 0' is used for consistency with the rest of the codebase.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2018-12-21 19:49:28 +01:00
parent 9d6e839ed8
commit cd2a429ed7
4 changed files with 6 additions and 19 deletions
+1 -2
View File
@@ -433,8 +433,7 @@ static int start_threads(sd_resolve *resolve, unsigned extra) {
unsigned n;
int r, k;
if (sigfillset(&ss) < 0)
return -errno;
assert_se(sigfillset(&ss) >= 0);
/* No signals in forked off threads please. We set the mask before forking, so that the threads never exist
* with a different mask than a fully blocked one */