Properly unmask signals for child processes

fixes #13269
This commit is contained in:
Gunnar Beutner 2016-11-22 13:45:59 +01:00
parent 930a3f1d37
commit 78fa197b9f
1 changed files with 8 additions and 0 deletions

View File

@ -165,6 +165,10 @@ static Value ProcessSpawnImpl(struct msghdr *msgh, const Dictionary::Ptr& reques
Log(LogWarning, "base", "Failed to renice child process.");
#endif /* HAVE_NICE */
sigset_t mask;
sigemptyset(&mask);
sigprocmask(SIG_SETMASK, &mask, NULL);
if (icinga2_execvpe(argv[0], argv, envp) < 0) {
char errmsg[512];
strcpy(errmsg, "execvpe(");
@ -228,6 +232,10 @@ static Value ProcessWaitPIDImpl(struct msghdr *msgh, const Dictionary::Ptr& requ
static void ProcessHandler(void)
{
sigset_t mask;
sigfillset(&mask);
sigprocmask(SIG_SETMASK, &mask, NULL);
rlimit rl;
if (getrlimit(RLIMIT_NOFILE, &rl) >= 0) {
rlim_t maxfds = rl.rlim_max;