diff --git a/daemon/daemon.cc b/daemon/daemon.cc index 335b32fcd..e6b10c8e8 100644 --- a/daemon/daemon.cc +++ b/daemon/daemon.cc @@ -10,6 +10,18 @@ #include #include +#include + +#ifdef __linux__ +#include +#include +#include +#endif + +#ifdef __FreeBSD__ +#include +#endif + #ifdef HAVE_SYSLOG #include #endif @@ -939,6 +951,12 @@ void tr_daemon::handle_error(tr_error* error) const int tr_main(int argc, char* argv[]) { + #ifdef __linux__ + prctl (PR_SET_PDEATHSIG, SIGTERM); + #elif defined(__FreeBSD__) + procctl (P_PID, 0, PROC_PDEATHSIG_CTL, &(int){ SIGTERM }); + #endif + tr_locale_set_global(""); int ret;