Do not need the opost flag to term_copy() now that we use pipes for

stdout/stderr when they are not a tty.
This commit is contained in:
Todd C. Miller
2010-05-03 10:41:26 -04:00
parent dd256f25ca
commit 0eda64b235
3 changed files with 4 additions and 7 deletions

View File

@@ -197,7 +197,7 @@ check_foreground(void)
{ {
foreground = tcgetpgrp(script_fds[SFD_USERTTY]) == ppgrp; foreground = tcgetpgrp(script_fds[SFD_USERTTY]) == ppgrp;
if (foreground && !tty_initialized) { if (foreground && !tty_initialized) {
if (term_copy(script_fds[SFD_USERTTY], script_fds[SFD_SLAVE], ttyout)) { if (term_copy(script_fds[SFD_USERTTY], script_fds[SFD_SLAVE])) {
tty_initialized = 1; tty_initialized = 1;
sync_ttysize(script_fds[SFD_USERTTY], script_fds[SFD_SLAVE]); sync_ttysize(script_fds[SFD_USERTTY], script_fds[SFD_SLAVE]);
} }
@@ -476,7 +476,7 @@ script_execve(struct command_details *details, char *argv[], char *envp[],
if (foreground) { if (foreground) {
/* Copy terminal attrs from user tty -> pty slave. */ /* Copy terminal attrs from user tty -> pty slave. */
if (term_copy(script_fds[SFD_USERTTY], script_fds[SFD_SLAVE], ttyout)) { if (term_copy(script_fds[SFD_USERTTY], script_fds[SFD_SLAVE])) {
tty_initialized = 1; tty_initialized = 1;
sync_ttysize(script_fds[SFD_USERTTY], script_fds[SFD_SLAVE]); sync_ttysize(script_fds[SFD_USERTTY], script_fds[SFD_SLAVE]);
} }

View File

@@ -176,7 +176,7 @@ void script_setup(uid_t);
/* term.c */ /* term.c */
int term_cbreak(int); int term_cbreak(int);
int term_copy(int, int, int); int term_copy(int, int);
int term_noecho(int); int term_noecho(int);
int term_raw(int, int, int); int term_raw(int, int, int);
int term_restore(int, int); int term_restore(int, int);

View File

@@ -164,15 +164,12 @@ term_cbreak(int fd)
} }
int int
term_copy(int src, int dst, int opost) term_copy(int src, int dst)
{ {
struct termios tt; struct termios tt;
if (tcgetattr(src, &tt) != 0) if (tcgetattr(src, &tt) != 0)
return(0); return(0);
/* Do not do post-processing unless opost set. */
if (!opost)
CLR(tt.c_oflag, OPOST);
/* XXX - add TCSANOW compat define */ /* XXX - add TCSANOW compat define */
if (tcsetattr(dst, TCSANOW|TCSASOFT, &tt) != 0) if (tcsetattr(dst, TCSANOW|TCSASOFT, &tt) != 0)
return(0); return(0);