summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-08-26 21:03:20 +0200
committerLennart Poettering <lennart@poettering.net>2014-08-26 21:03:23 +0200
commit24a5d6b04e17d447cf122f02a8a2dedd843cce45 (patch)
tree090dba75871afe3e375a3a38b75ad9a2eaedc7fe /src
parentf2322f0b64107b2eee1fadb6c59857381277a9f8 (diff)
util: make sure reset_all_signal_handlers() continues with all other signal handlers when one sigaction() fails
After all, we usually don't check for failures here, and it is better to do as much as we can...
Diffstat (limited to 'src')
-rw-r--r--src/shared/util.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index fc6f668726..4af2d3ceba 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -937,7 +937,7 @@ int readlink_and_canonicalize(const char *p, char **r) {
}
int reset_all_signal_handlers(void) {
- int sig;
+ int sig, r = 0;
for (sig = 1; sig < _NSIG; sig++) {
struct sigaction sa = {
@@ -945,17 +945,18 @@ int reset_all_signal_handlers(void) {
.sa_flags = SA_RESTART,
};
+ /* These two cannot be caught... */
if (sig == SIGKILL || sig == SIGSTOP)
continue;
/* On Linux the first two RT signals are reserved by
* glibc, and sigaction() will return EINVAL for them. */
if ((sigaction(sig, &sa, NULL) < 0))
- if (errno != EINVAL)
- return -errno;
+ if (errno != EINVAL && r == 0)
+ r = -errno;
}
- return 0;
+ return r;
}
char *strstrip(char *s) {