diff options
author | brian <brian@FreeBSD.org> | 2001-07-31 09:53:20 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2001-07-31 09:53:20 +0000 |
commit | 63673e8c2d382b58de7eaaa3456539096b78c46f (patch) | |
tree | 4b45925f7e75148aae7dc2e61938fd564d3e5a01 /libexec/pppoed | |
parent | 2f4c944b652a090d33e78f58bc222a73bf7cb9df (diff) | |
download | FreeBSD-src-63673e8c2d382b58de7eaaa3456539096b78c46f.zip FreeBSD-src-63673e8c2d382b58de7eaaa3456539096b78c46f.tar.gz |
Use sigaction() without SA_RESTART rather than signal() so that we
don't block in NgRecvData() after receiving a signal.
MFC after: 1 week
Diffstat (limited to 'libexec/pppoed')
-rw-r--r-- | libexec/pppoed/pppoed.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libexec/pppoed/pppoed.c b/libexec/pppoed/pppoed.c index 870df09..f6b4907 100644 --- a/libexec/pppoed/pppoed.c +++ b/libexec/pppoed/pppoed.c @@ -77,7 +77,6 @@ static void Farewell(int sig) { ReceivedSignal = sig; - signal(sig, SIG_DFL); /* If something makes us block... */ } static int @@ -469,6 +468,7 @@ main(int argc, char **argv) unsigned char response[1024]; const char *prog, *provider, *acname; struct ngm_connect ngc; + struct sigaction act; int ch, cs, ds, ret, optF, optd, optn, sz, f; const char *pidfile; @@ -591,10 +591,14 @@ main(int argc, char **argv) if (!optF && optn) NgSetErrLog(nglog, nglogx); - signal(SIGHUP, Farewell); - signal(SIGINT, Farewell); - signal(SIGQUIT, Farewell); - signal(SIGTERM, Farewell); + memset(&act, '\0', sizeof act); + act.sa_handler = Farewell; + act.sa_flags = SA_RESETHAND; + sigemptyset(&act.sa_mask); + sigaction(SIGHUP, &act, NULL); + sigaction(SIGINT, &act, NULL); + sigaction(SIGQUIT, &act, NULL); + sigaction(SIGTERM, &act, NULL); while (!ReceivedSignal) { if (*provider) |