From af80178b85984b7a8086ae8892387a94ec77de99 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 17 Jan 2001 16:34:36 +0000 Subject: [PATCH] Block all signals in Exit() to avoid a signal race. There is still a tiny window but I'm not going to worry about it. --- visudo.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/visudo.c b/visudo.c index 09f3a19a6..98943b654 100644 --- a/visudo.c +++ b/visudo.c @@ -653,6 +653,18 @@ static RETSIGTYPE Exit(sig) int sig; { +#ifdef POSIX_SIGNALS + sigset_t mask; + + sigfillset(&mask); + (void) sigprocmask(SIG_BLOCK, &mask, NULL); +#else + unsigned int mask; + + mask = 0xffffffff; + (void) sigblock((int) mask); +#endif /* POSIX_SIGNALS */ + (void) unlink(stmp); if (sig > 0)