0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-05-18 10:53:48 +02:00

ircd::exec: Set PDEATHSIG in the child for crash action.

This commit is contained in:
Jason Volk 2020-10-27 05:24:44 -07:00
parent 813b686e97
commit ea5ebb4a12
2 changed files with 7 additions and 0 deletions

View file

@ -1052,6 +1052,7 @@ RB_CHK_SYSHEADER(sys/sysinfo.h, [SYS_SYSINFO_H])
RB_CHK_SYSHEADER(sys/eventfd.h, [SYS_EVENTFD_H])
RB_CHK_SYSHEADER(sys/inotify.h, [SYS_INOTIFY_H])
RB_CHK_SYSHEADER(sys/sysmacros.h, [SYS_SYSMACROS_H])
RB_CHK_SYSHEADER(sys/prctl.h, [SYS_PRCTL_H])
RB_CHK_SYSHEADER(linux/aio_abi.h, [LINUX_AIO_ABI_H])
RB_CHK_SYSHEADER(linux/magic.h, [LINUX_MAGIC_H])
RB_CHK_SYSHEADER(linux/perf_event.h, [LINUX_PERF_EVENT_H])

View file

@ -8,6 +8,7 @@
// copyright notice and this permission notice is present in all copies. The
// full license for this software is available in the LICENSE file.
#include <RB_INC_SYS_PRCTL_H
#include <boost/process.hpp>
#include <boost/process/extend.hpp>
@ -339,6 +340,11 @@ const noexcept
};
#endif
// Set the parent death signal in case of a crash so we won't go zombie.
#if defined(HAVE_SYS_PRCTL_H)
sys::call(prctl, PR_SET_PDEATHSIG, SIGTERM);
#endif
// Ignore SIGINT/SIGQUIT that way the administrator striking ctrl-c or
// ctrl-\ at the console doesn't terminate the child.
#if defined(HAVE_SIGNAL_H)