]> granicus.if.org Git - sudo/commitdiff
Don't block keyboard interrupt signals, just set them to SIG_IGN.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 9 Dec 2001 05:09:10 +0000 (05:09 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 9 Dec 2001 05:09:10 +0000 (05:09 +0000)
sudo.c

diff --git a/sudo.c b/sudo.c
index b0099dc18b3aa2a37c1af5f07b0328f417cf6a84..10fbf81f090b9d473db8c22a4826461202d912e2 100644 (file)
--- 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));