summaryrefslogtreecommitdiff
path: root/usr.bin/tip/tipout.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2001-09-04 23:36:00 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2001-09-04 23:36:00 +0000
commit6e69b2a3e9a34411460d33a432a805b3eb1924d1 (patch)
tree33cfe52f5da9645a00ca15af49ceefdd612696d2 /usr.bin/tip/tipout.c
parent102264589c8731b5f0fb00b204e5963726ecec83 (diff)
Replace the deprecated BSD sigsetmask/sigblock/sigpause functions with their POSIX counterparts.
Diffstat (limited to 'usr.bin/tip/tipout.c')
-rw-r--r--usr.bin/tip/tipout.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/usr.bin/tip/tipout.c b/usr.bin/tip/tipout.c
index 98bbab4419a..45e2f2b0802 100644
--- a/usr.bin/tip/tipout.c
+++ b/usr.bin/tip/tipout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tipout.c,v 1.6 1997/09/01 23:24:27 deraadt Exp $ */
+/* $OpenBSD: tipout.c,v 1.7 2001/09/04 23:35:59 millert Exp $ */
/* $NetBSD: tipout.c,v 1.5 1996/12/29 10:34:12 cgd Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)tipout.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: tipout.c,v 1.6 1997/09/01 23:24:27 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: tipout.c,v 1.7 2001/09/04 23:35:59 millert Exp $";
#endif /* not lint */
#include "tip.h"
@@ -125,7 +125,7 @@ tipout()
register char *cp;
register int cnt;
extern int errno;
- int omask;
+ sigset_t mask, omask;
signal(SIGINT, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
@@ -135,19 +135,27 @@ tipout()
signal(SIGHUP, intTERM); /* for dial-ups */
signal(SIGSYS, intSYS); /* beautify toggle */
(void) setjmp(sigbuf);
- for (omask = 0;; sigsetmask(omask)) {
+ sigprocmask(SIG_BLOCK, NULL, &omask);
+ for (;;) {
+ sigprocmask(SIG_SETMASK, &omask, NULL);
cnt = read(FD, buf, BUFSIZ);
if (cnt <= 0) {
/* lost carrier */
if (cnt < 0 && errno == EIO) {
- sigblock(sigmask(SIGTERM));
+ sigemptyset(&mask);
+ sigaddset(&mask, SIGTERM);
+ sigprocmask(SIG_BLOCK, &mask, NULL);
intTERM();
/*NOTREACHED*/
}
continue;
}
-#define ALLSIGS sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)
- omask = sigblock(ALLSIGS);
+ sigemptyset(&mask);
+ sigaddset(&mask, SIGEMT);
+ sigaddset(&mask, SIGTERM);
+ sigaddset(&mask, SIGIOT);
+ sigaddset(&mask, SIGSYS);
+ sigprocmask(SIG_BLOCK, &mask, NULL);
for (cp = buf; cp < buf + cnt; cp++)
*cp &= STRIP_PAR;
write(1, buf, cnt);