summaryrefslogtreecommitdiff
path: root/usr.bin/tip/tipout.c
diff options
context:
space:
mode:
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);