]> granicus.if.org Git - sudo/commitdiff
If we get a signal other than SIGCHLD in the monitor, pass it directly
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 2 Feb 2011 19:24:58 +0000 (14:24 -0500)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 2 Feb 2011 19:24:58 +0000 (14:24 -0500)
to the child.

--HG--
branch : 1.7

exec_pty.c

index deb685a57a1fbcbbbee205b33041505ec1fe9d7e..fc225ff82797ce9c25ab121cc5bd4e6b95f8ffea 100644 (file)
@@ -716,7 +716,6 @@ exec_monitor(path, argv, envp, backchannel, rbac)
        error(1, "cannot create pipe");
 
     /* Reset SIGWINCH and SIGALRM. */
-    /* XXX - restore all signals except SIGPIPE? */
     zero_bytes(&sa, sizeof(sa));
     sigemptyset(&sa.sa_mask);
     sa.sa_flags = SA_RESTART;
@@ -835,7 +834,6 @@ exec_monitor(path, argv, envp, backchannel, rbac)
        }
 
        if (FD_ISSET(signal_pipe[0], fdsr)) {
-           /* Read child status. */
            n = read(signal_pipe[0], &signo, sizeof(signo));
            if (n == -1) {
                if (errno == EINTR || errno == EAGAIN)
@@ -843,11 +841,15 @@ exec_monitor(path, argv, envp, backchannel, rbac)
                warning("error reading from signal pipe");
                goto done;
            }
-           /* We should only ever get SIGCHLD. */
-           if (signo == SIGCHLD) {
+           /*
+            * Handle SIGCHLD specially and deliver other signals
+            * directly to the child.
+            */
+           if (signo == SIGCHLD)
                alive = handle_sigchld(backchannel, &cstat);
-               continue;
-           }
+           else
+               deliver_signal(child, signo);
+           continue;
        }
        if (errpipe[0] != -1 && FD_ISSET(errpipe[0], fdsr)) {
            /* read errno or EOF from command pipe */