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:
Todd C. Miller
2015-09-07 06:06:08 -06:00
parent 448b18de2b
commit 70914b3328

View File

@@ -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,10 +437,8 @@ 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); ttymode = TERM_RAW;
} while (!n && errno == EINTR);
ttymode = TERM_RAW;
} }
rval = SIGCONT_FG; /* resume command in foreground */ rval = SIGCONT_FG; /* resume command in foreground */
break; break;
@@ -488,10 +486,8 @@ 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); ttymode = TERM_RAW;
} while (!n && errno == EINTR);
ttymode = TERM_RAW;
} else { } else {
/* Background process, no access to tty. */ /* Background process, no access to tty. */
ttymode = TERM_COOKED; ttymode = TERM_COOKED;
@@ -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)) {
ttymode = TERM_RAW; if (sudo_term_raw(io_fds[SFD_USERTTY], 0))
do { ttymode = TERM_RAW;
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"));
} }
} }