]> granicus.if.org Git - sudo/commitdiff
Use special values SIGCONT_FG and SIGCONT_BG instead of SIGUSR1 and
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 7 Feb 2011 01:38:09 +0000 (20:38 -0500)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 7 Feb 2011 01:38:09 +0000 (20:38 -0500)
SIGUSR2 to indicate whether the child should be continued in the
foreground or background.

--HG--
branch : 1.7

exec_pty.c

index 68edc11a6f481e20321665bf02ae8419ba55da58..405675943aaa5e8d8748427a840addc512898592 100644 (file)
@@ -145,7 +145,8 @@ check_foreground()
 
 /*
  * Suspend sudo if the underlying command is suspended.
- * Returns SIGUSR1 if the child should be resume in foreground else SIGUSR2.
+ * Returns SIGCONT_FG if the child should be resume in the
+ * foreground or SIGCONT_BG if it is a background process.
  */
 int
 suspend_parent(signo)
@@ -170,7 +171,7 @@ suspend_parent(signo)
                } while (!n && errno == EINTR);
                ttymode = TERM_RAW;
            }
-           rval = SIGUSR1; /* resume child in foreground */
+           rval = SIGCONT_FG; /* resume child in foreground */
            break;
        }
        ttymode = TERM_RAW;
@@ -213,7 +214,7 @@ suspend_parent(signo)
        }
 
        sigaction(signo, &osa, NULL);
-       rval = ttymode == TERM_RAW ? SIGUSR1 : SIGUSR2;
+       rval = ttymode == TERM_RAW ? SIGCONT_FG : SIGCONT_BG;
        break;
     }
 
@@ -587,14 +588,14 @@ deliver_signal(pid, signo)
 
     /* Handle signal from parent. */
     switch (signo) {
-    case SIGUSR1:
+    case SIGCONT_FG:
        /* Continue in foreground, grant it controlling tty. */
        do {
            status = tcsetpgrp(io_fds[SFD_SLAVE], pid);
        } while (status == -1 && errno == EINTR);
        killpg(pid, SIGCONT);
        break;
-    case SIGUSR2:
+    case SIGCONT_BG:
        /* Continue in background, I take controlling tty. */
        do {
            status = tcsetpgrp(io_fds[SFD_SLAVE], getpid());