sudo_term_* already restart themselve for all but SIGTTOU so we
don't need to use our own restart loops.
This commit is contained in:
@@ -423,7 +423,7 @@ suspend_parent(int signo)
|
|||||||
{
|
{
|
||||||
char signame[SIG2STR_MAX];
|
char signame[SIG2STR_MAX];
|
||||||
sigaction_t sa, osa;
|
sigaction_t sa, osa;
|
||||||
int n, rval = 0;
|
int rval = 0;
|
||||||
debug_decl(suspend_parent, SUDO_DEBUG_EXEC);
|
debug_decl(suspend_parent, SUDO_DEBUG_EXEC);
|
||||||
|
|
||||||
switch (signo) {
|
switch (signo) {
|
||||||
@@ -437,9 +437,7 @@ suspend_parent(int signo)
|
|||||||
check_foreground();
|
check_foreground();
|
||||||
if (foreground) {
|
if (foreground) {
|
||||||
if (ttymode != TERM_RAW) {
|
if (ttymode != TERM_RAW) {
|
||||||
do {
|
if (sudo_term_raw(io_fds[SFD_USERTTY], 0))
|
||||||
n = sudo_term_raw(io_fds[SFD_USERTTY], 0);
|
|
||||||
} while (!n && errno == EINTR);
|
|
||||||
ttymode = TERM_RAW;
|
ttymode = TERM_RAW;
|
||||||
}
|
}
|
||||||
rval = SIGCONT_FG; /* resume command in foreground */
|
rval = SIGCONT_FG; /* resume command in foreground */
|
||||||
@@ -488,9 +486,7 @@ suspend_parent(int signo)
|
|||||||
|
|
||||||
if (foreground) {
|
if (foreground) {
|
||||||
/* Foreground process, set tty to raw mode. */
|
/* Foreground process, set tty to raw mode. */
|
||||||
do {
|
if (sudo_term_raw(io_fds[SFD_USERTTY], 0))
|
||||||
n = sudo_term_raw(io_fds[SFD_USERTTY], 0);
|
|
||||||
} while (!n && errno == EINTR);
|
|
||||||
ttymode = TERM_RAW;
|
ttymode = TERM_RAW;
|
||||||
} else {
|
} else {
|
||||||
/* Background process, no access to tty. */
|
/* Background process, no access to tty. */
|
||||||
@@ -708,7 +704,7 @@ int
|
|||||||
fork_pty(struct command_details *details, int sv[], sigset_t *omask)
|
fork_pty(struct command_details *details, int sv[], sigset_t *omask)
|
||||||
{
|
{
|
||||||
struct command_status cstat;
|
struct command_status cstat;
|
||||||
int io_pipe[3][2], n;
|
int io_pipe[3][2];
|
||||||
sigaction_t sa;
|
sigaction_t sa;
|
||||||
sigset_t mask;
|
sigset_t mask;
|
||||||
pid_t child;
|
pid_t child;
|
||||||
@@ -820,12 +816,8 @@ fork_pty(struct command_details *details, int sv[], sigset_t *omask)
|
|||||||
|
|
||||||
/* Start out in raw mode unless part of a pipeline or backgrounded. */
|
/* Start out in raw mode unless part of a pipeline or backgrounded. */
|
||||||
if (!pipeline && !ISSET(details->flags, CD_EXEC_BG)) {
|
if (!pipeline && !ISSET(details->flags, CD_EXEC_BG)) {
|
||||||
|
if (sudo_term_raw(io_fds[SFD_USERTTY], 0))
|
||||||
ttymode = TERM_RAW;
|
ttymode = TERM_RAW;
|
||||||
do {
|
|
||||||
n = sudo_term_raw(io_fds[SFD_USERTTY], 0);
|
|
||||||
} while (!n && errno == EINTR);
|
|
||||||
if (!n)
|
|
||||||
sudo_fatal(U_("unable to set terminal to raw mode"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user