X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fshared%2Futil.c;h=4af2d3cebad19a261a3134a162b20f6520f419ae;hp=fc6f668726c60ee7d00db1809b7e3f8a3f4de744;hb=24a5d6b04e17d447cf122f02a8a2dedd843cce45;hpb=f2322f0b64107b2eee1fadb6c59857381277a9f8;ds=sidebyside diff --git a/src/shared/util.c b/src/shared/util.c index fc6f66872..4af2d3ceb 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) {