From: Todd C. Miller Date: Sun, 9 Dec 2001 05:09:10 +0000 (+0000) Subject: Don't block keyboard interrupt signals, just set them to SIG_IGN. X-Git-Tag: SUDO_1_6_4~148 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=60bbfa42df22f26757b2e61011c692120acb99a8;p=sudo Don't block keyboard interrupt signals, just set them to SIG_IGN. --- diff --git a/sudo.c b/sudo.c index b0099dc18..10fbf81f0 100644 --- a/sudo.c +++ b/sudo.c @@ -146,7 +146,7 @@ main(argc, argv, envp) int cmnd_status; int sudo_mode; int pwflag; - sigset_t set, oset; + sigaction_t sa; extern int printmatches; extern char **environ; @@ -170,14 +170,15 @@ main(argc, argv, envp) } /* - * Block signals so the user cannot interrupt us at some point and - * avoid the logging. + * Ignore keyboard-generated signals so the user cannot interrupt + * us at some point and avoid the logging. */ - (void) sigemptyset(&set); - (void) sigaddset(&set, SIGINT); - (void) sigaddset(&set, SIGQUIT); - (void) sigaddset(&set, SIGTSTP); - (void) sigprocmask(SIG_BLOCK, &set, &oset); + sigemptyset(&sa.sa_mask); + sa.sa_flags = SA_RESTART; + sa.sa_handler = SIG_IGN; + (void) sigaction(SIGINT, &sa, NULL); + (void) sigaction(SIGQUIT, &sa, NULL); + (void) sigaction(SIGTSTP, &sa, NULL); /* * Setup signal handlers, turn off core dumps, and close open files. @@ -335,9 +336,6 @@ main(argc, argv, envp) /* Close the password file */ endpwent(); - /* Reset signal mask before we exec. */ - (void) sigprocmask(SIG_SETMASK, &oset, NULL); - /* Override user's umask if configured to do so. */ if (def_ival(I_UMASK) != 0777) (void) umask(def_mode(I_UMASK));