Merge pull request #8011 from Icinga/bugfix/reset-sigpipe-6912

Reset all signal handlers of child processes
This commit is contained in:
Alexander Aleksandrovič Klimov 2024-02-15 12:22:36 +01:00 committed by GitHub
commit 9db1c4aca3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#ifndef _WIN32
# include <execvpe.h>
# include <poll.h>
# include <signal.h>
# include <string.h>
# ifndef __APPLE__
@ -170,6 +171,17 @@ static Value ProcessSpawnImpl(struct msghdr *msgh, const Dictionary::Ptr& reques
}
#endif /* HAVE_NICE */
{
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sa.sa_handler = SIG_DFL;
for (int sig = 1; sig <= 31; ++sig) {
(void)sigaction(sig, &sa, nullptr);
}
}
sigset_t mask;
sigemptyset(&mask);
sigprocmask(SIG_SETMASK, &mask, nullptr);