Debian Codegraph @

build-aux/flatpak/transmission_pdeathsig.patch

raw
1 diff --git a/daemon/daemon.cc b/daemon/daemon.cc
2 index 335b32fcd..e6b10c8e8 100644
3 --- a/daemon/daemon.cc
4 +++ b/daemon/daemon.cc
5 @@ -10,6 +10,18 @@
6 #include <iostream>
7 #include <memory>
8
9 +#include <signal.h>
10 +
11 +#ifdef __linux__
12 +#include <sys/prctl.h>
13 +#include <sys/types.h>
14 +#include <sys/syscall.h>
15 +#endif
16 +
17 +#ifdef __FreeBSD__
18 +#include <sys/procctl.h>
19 +#endif
20 +
21 #ifdef HAVE_SYSLOG
22 #include <syslog.h>
23 #endif
24 @@ -939,6 +951,12 @@ void tr_daemon::handle_error(tr_error* error) const
25
26 int tr_main(int argc, char* argv[])
27 {
28 + #ifdef __linux__
29 + prctl (PR_SET_PDEATHSIG, SIGTERM);
30 + #elif defined(__FreeBSD__)
31 + procctl (P_PID, 0, PROC_PDEATHSIG_CTL, &(int){ SIGTERM });
32 + #endif
33 +
34 tr_locale_set_global("");
35
36 int ret;