From 27c14eada725456596575fe35793de8bf682fae3 Mon Sep 17 00:00:00 2001 From: dholland Date: Sun, 11 Aug 2013 05:48:56 +0000 Subject: [PATCH] Use siglongjmp to jump out of signal handlers. --- libexec/getty/main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libexec/getty/main.c b/libexec/getty/main.c index aaf059470d68..1f33b4ba4c9b 100644 --- a/libexec/getty/main.c +++ b/libexec/getty/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.61 2013/08/11 05:42:41 dholland Exp $ */ +/* $NetBSD: main.c,v 1.62 2013/08/11 05:48:56 dholland Exp $ */ /*- * Copyright (c) 1980, 1993 @@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\ #if 0 static char sccsid[] = "from: @(#)main.c 8.1 (Berkeley) 6/20/93"; #else -__RCSID("$NetBSD: main.c,v 1.61 2013/08/11 05:42:41 dholland Exp $"); +__RCSID("$NetBSD: main.c,v 1.62 2013/08/11 05:48:56 dholland Exp $"); #endif #endif /* not lint */ @@ -135,7 +135,7 @@ const unsigned char partab[] = { static void clearscreen(void); -jmp_buf timeout; +sigjmp_buf timeout; static void /*ARGSUSED*/ @@ -144,10 +144,10 @@ dingdong(int signo) (void)alarm(0); (void)signal(SIGALRM, SIG_DFL); - longjmp(timeout, 1); + siglongjmp(timeout, 1); } -jmp_buf intrupt; +sigjmp_buf intrupt; static void /*ARGSUSED*/ @@ -155,7 +155,7 @@ interrupt(int signo) { (void)signal(SIGINT, interrupt); - longjmp(intrupt, 1); + siglongjmp(intrupt, 1); } /* @@ -357,7 +357,7 @@ main(int argc, char *argv[], char *envp[]) if (IM && *IM) putf(IM); oflush(); - if (setjmp(timeout)) { + if (sigsetjmp(timeout, 1)) { tmode.c_ispeed = tmode.c_ospeed = 0; (void)tcsetattr(0, TCSANOW, &tmode); exit(1); @@ -455,7 +455,7 @@ getname(void) /* * Interrupt may happen if we use CBREAK mode */ - if (setjmp(intrupt)) { + if (sigsetjmp(intrupt, 1)) { (void)signal(SIGINT, SIG_IGN); return (0); }