diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2001-09-04 23:36:00 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2001-09-04 23:36:00 +0000 |
commit | 6e69b2a3e9a34411460d33a432a805b3eb1924d1 (patch) | |
tree | 33cfe52f5da9645a00ca15af49ceefdd612696d2 /usr.sbin/ppp | |
parent | 102264589c8731b5f0fb00b204e5963726ecec83 (diff) |
Replace the deprecated BSD sigsetmask/sigblock/sigpause functions with their POSIX counterparts.
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r-- | usr.sbin/ppp/ppp/lcp.c | 7 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/timer.c | 20 |
2 files changed, 17 insertions, 10 deletions
diff --git a/usr.sbin/ppp/ppp/lcp.c b/usr.sbin/ppp/ppp/lcp.c index a76f0928d7e..9980ebd9641 100644 --- a/usr.sbin/ppp/ppp/lcp.c +++ b/usr.sbin/ppp/ppp/lcp.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: lcp.c,v 1.31 2001/08/19 23:22:18 brian Exp $ + * $OpenBSD: lcp.c,v 1.32 2001/09/04 23:35:59 millert Exp $ */ #include <sys/param.h> @@ -968,13 +968,16 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type, if (lcp->want_magic) { /* Validate magic number */ if (magic == lcp->want_magic) { + sigset_t emptyset; + log_Printf(LogLCP, "Magic is same (%08lx) - %d times\n", (u_long)magic, ++lcp->LcpFailedMagic); lcp->want_magic = GenerateMagic(); memcpy(dec->nakend, cp, 6); dec->nakend += 6; ualarm(TICKUNIT * (4 + 4 * lcp->LcpFailedMagic), 0); - sigpause(0); + sigemptyset(&emptyset); + sigsuspend(&emptyset); } else { lcp->his_magic = magic; memcpy(dec->ackend, cp, length); diff --git a/usr.sbin/ppp/ppp/timer.c b/usr.sbin/ppp/ppp/timer.c index b701abe7e2f..67a3de36a85 100644 --- a/usr.sbin/ppp/ppp/timer.c +++ b/usr.sbin/ppp/ppp/timer.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: timer.c,v 1.9 2001/06/13 21:33:42 brian Exp $ + * $OpenBSD: timer.c,v 1.10 2001/09/04 23:35:59 millert Exp $ */ #include <errno.h> @@ -63,11 +63,13 @@ tState2Nam(u_int state) void timer_Stop(struct pppTimer *tp) { - int omask; + sigset_t mask, omask; - omask = sigblock(sigmask(SIGALRM)); + sigemptyset(&mask); + sigaddset(&mask, SIGALRM); + sigprocmask(SIG_BLOCK, &mask, &omask); StopTimerNoBlock(tp); - sigsetmask(omask); + sigprocmask(SIG_SETMASK, &omask, NULL); } void @@ -76,16 +78,18 @@ timer_Start(struct pppTimer *tp) struct itimerval itimer; struct pppTimer *t, *pt; u_long ticks = 0; - int omask; + sigset_t mask, omask; - omask = sigblock(sigmask(SIGALRM)); + sigemptyset(&mask); + sigaddset(&mask, SIGALRM); + sigprocmask(SIG_BLOCK, &mask, &omask); if (tp->state != TIMER_STOPPED) StopTimerNoBlock(tp); if (tp->load == 0) { log_Printf(LogTIMER, "%s timer[%p] has 0 load!\n", tp->name, tp); - sigsetmask(omask); + sigprocmask(SIG_SETMASK, &omask, NULL); return; } @@ -121,7 +125,7 @@ timer_Start(struct pppTimer *tp) if (t) t->rest -= tp->rest; - sigsetmask(omask); + sigprocmask(SIG_SETMASK, &omask, NULL); } static void |