diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2018-03-06 13:09:36 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2018-03-06 13:09:36 +0300 |
commit | 89056070effd890afcefaefcd3ee257dc1a447ee (patch) | |
tree | e57a828b66fb7ba6149453046724270ec472eb0a /accel-pppd/main.c | |
parent | 32b7c558f8bcf59ab6b6c3889a0ab7ab3eb022b7 (diff) | |
download | accel-ppp-89056070effd890afcefaefcd3ee257dc1a447ee.tar.gz accel-ppp-89056070effd890afcefaefcd3ee257dc1a447ee.zip |
terminate program gracefully by SIGINT
Diffstat (limited to 'accel-pppd/main.c')
-rw-r--r-- | accel-pppd/main.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/accel-pppd/main.c b/accel-pppd/main.c index d77d7c4..e346f45 100644 --- a/accel-pppd/main.c +++ b/accel-pppd/main.c @@ -242,6 +242,7 @@ int main(int _argc, char **_argv) struct sigaction sa; int pagesize = sysconf(_SC_PAGE_SIZE); int internal = 0; + int no_sigint = 0; argc = _argc; argv = _argv; @@ -269,6 +270,8 @@ int main(int _argc, char **_argv) mprotect(conf_dump, len, PROT_READ); } else if (!strcmp(argv[i], "--internal")) internal = 1; + else if (!strcmp(argv[i], "--no-sigint")) + no_sigint = 1; } if (!conf_file) @@ -344,19 +347,21 @@ int main(int _argc, char **_argv) sigdelset(&set, SIGBUS); sigdelset(&set, SIGHUP); sigdelset(&set, SIGIO); - sigdelset(&set, SIGINT); sigdelset(&set, SIGUSR1); sigdelset(&set, 35); sigdelset(&set, 36); + if (no_sigint) + sigdelset(&set, SIGINT); pthread_sigmask(SIG_SETMASK, &set, &orig_set); sigemptyset(&set); - //sigaddset(&set, SIGINT); sigaddset(&set, SIGTERM); sigaddset(&set, SIGSEGV); sigaddset(&set, SIGILL); sigaddset(&set, SIGFPE); sigaddset(&set, SIGBUS); + if (!no_sigint) + sigaddset(&set, SIGINT); #ifdef USE_BACKUP backup_restore(internal); |