=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/login/login.c,v retrieving revision 1.47 retrieving revision 1.48 diff -c -r1.47 -r1.48 *** src/usr.bin/login/login.c 2002/07/02 01:15:08 1.47 --- src/usr.bin/login/login.c 2002/07/02 01:36:19 1.48 *************** *** 1,4 **** ! /* $OpenBSD: login.c,v 1.47 2002/07/02 01:15:08 deraadt Exp $ */ /* $NetBSD: login.c,v 1.13 1996/05/15 23:50:16 jtc Exp $ */ /*- --- 1,4 ---- ! /* $OpenBSD: login.c,v 1.48 2002/07/02 01:36:19 millert Exp $ */ /* $NetBSD: login.c,v 1.13 1996/05/15 23:50:16 jtc Exp $ */ /*- *************** *** 77,83 **** #if 0 static char sccsid[] = "@(#)login.c 8.4 (Berkeley) 4/2/94"; #endif ! static char rcsid[] = "$OpenBSD: login.c,v 1.47 2002/07/02 01:15:08 deraadt Exp $"; #endif /* not lint */ /* --- 77,83 ---- #if 0 static char sccsid[] = "@(#)login.c 8.4 (Berkeley) 4/2/94"; #endif ! static char rcsid[] = "$OpenBSD: login.c,v 1.48 2002/07/02 01:36:19 millert Exp $"; #endif /* not lint */ /* *************** *** 100,106 **** #include #include #include - #include #include #include #include --- 100,105 ---- *************** *** 808,831 **** return ((t = getttynam(ttyn)) && t->ty_status & TTY_SECURE); } - jmp_buf motdinterrupt; - void motd(void) { char tbuf[8192], *motd; int fd, nchars; ! sig_t oldint; motd = login_getcapstr(lc, "welcome", _PATH_MOTDFILE, _PATH_MOTDFILE); if ((fd = open(motd, O_RDONLY, 0)) < 0) return; ! oldint = signal(SIGINT, sigint); ! if (setjmp(motdinterrupt) == 0) ! while ((nchars = read(fd, tbuf, sizeof(tbuf))) > 0) ! (void)write(fileno(stdout), tbuf, nchars); ! (void)signal(SIGINT, oldint); (void)close(fd); } --- 807,836 ---- return ((t = getttynam(ttyn)) && t->ty_status & TTY_SECURE); } void motd(void) { char tbuf[8192], *motd; int fd, nchars; ! struct sigaction sa, osa; motd = login_getcapstr(lc, "welcome", _PATH_MOTDFILE, _PATH_MOTDFILE); if ((fd = open(motd, O_RDONLY, 0)) < 0) return; ! ! memset(&sa, 0, sizeof(sa)); ! sa.sa_handler = sigint; ! sigemptyset(&sa.sa_mask); ! sa.sa_flags = 0; /* don't set SA_RESTART */ ! (void)sigaction(SIGINT, &sa, &osa); ! ! /* read and spew motd until EOF, error, or SIGINT */ ! while ((nchars = read(fd, tbuf, sizeof(tbuf))) > 0 && ! write(STDOUT_FILENO, tbuf, nchars) == nchars) ! ; ! ! (void)sigaction(SIGINT, &osa, NULL); (void)close(fd); } *************** *** 833,839 **** void sigint(int signo) { ! longjmp(motdinterrupt, 1); } /* ARGSUSED */ --- 838,844 ---- void sigint(int signo) { ! return; /* just interupt syscall */ } /* ARGSUSED */