b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | commit 3790bd05ed86b1692719df22857ef76c1293b01c |
| 2 | Author: Harald Geyer <harald@ccbib.org> |
| 3 | Date: Sun Feb 18 19:24:48 2018 +0100 |
| 4 | |
| 5 | Make modem processes terminate when main process dies |
| 6 | |
| 7 | --- a/src/smsd.c |
| 8 | +++ b/src/smsd.c |
| 9 | @@ -34,6 +34,7 @@ Either version 2 of the License, or (at |
| 10 | #ifndef DISABLE_INOTIFY |
| 11 | #include <sys/inotify.h> |
| 12 | #endif |
| 13 | +#include <sys/prctl.h> |
| 14 | |
| 15 | #include "extras.h" |
| 16 | #include "locking.h" |
| 17 | @@ -8100,6 +8101,7 @@ int main(int argc,char** argv) |
| 18 | |
| 19 | if (pid == 0) |
| 20 | { |
| 21 | + prctl(PR_SET_PDEATHSIG, SIGTERM, 0, 0, 0); |
| 22 | process_id = i; |
| 23 | strcpy(process_title, DEVICE.name); |
| 24 | apply_process_name(argc, argv, process_title); |