diff options
author | Matt Johnston <matt@ucc.asn.au> | 2005-03-02 04:14:26 +0000 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2005-03-02 04:14:26 +0000 |
commit | 50e5ad7e0104532e4324b83fd680445bb6d53a18 (patch) | |
tree | ba40f764cbfdde66a14eaf11a40ffd1aca98d15d | |
parent | 99bf5cc78ca11a6c55b4647f27920b7c203321ea (diff) | |
download | dropbear-50e5ad7e0104532e4324b83fd680445bb6d53a18.tar.gz |
* Reset the non-blocking status of stdout and stderr as well on exitnonblock-stdout-stderr
-rw-r--r-- | cli-session.c | 14 | ||||
-rw-r--r-- | session.h | 4 |
2 files changed, 14 insertions, 4 deletions
diff --git a/cli-session.c b/cli-session.c index 4d6a645..0ac120e 100644 --- a/cli-session.c +++ b/cli-session.c @@ -113,10 +113,14 @@ static void cli_session_init() { cli_ses.tty_raw_mode = 0; cli_ses.winchange = 0; - /* We store stdin's flags, so we can set them back on exit (otherwise - * busybox's ash isn't happy */ + /* We store std{in,out,err}'s flags, so we can set them back on exit + * (otherwise busybox's ash isn't happy */ cli_ses.stdincopy = dup(STDIN_FILENO); cli_ses.stdinflags = fcntl(STDIN_FILENO, F_GETFL, 0); + cli_ses.stdoutcopy = dup(STDOUT_FILENO); + cli_ses.stdoutflags = fcntl(STDOUT_FILENO, F_GETFL, 0); + cli_ses.stderrcopy = dup(STDERR_FILENO); + cli_ses.stderrflags = fcntl(STDERR_FILENO, F_GETFL, 0); cli_ses.retval = EXIT_SUCCESS; /* Assume it's clean if we don't get a specific exit status */ @@ -250,9 +254,11 @@ void cli_session_cleanup() { return; } - /* Set stdin back to non-blocking - busybox ash dies nastily - * if we don't revert the flags */ + /* Set std{in,out,err} back to non-blocking - busybox ash dies nastily if + * we don't revert the flags */ fcntl(cli_ses.stdincopy, F_SETFL, cli_ses.stdinflags); + fcntl(cli_ses.stdoutcopy, F_SETFL, cli_ses.stdoutflags); + fcntl(cli_ses.stderrcopy, F_SETFL, cli_ses.stderrflags); cli_tty_cleanup(); @@ -218,6 +218,10 @@ struct clientsession { struct termios saved_tio; int stdincopy; int stdinflags; + int stdoutcopy; + int stdoutflags; + int stderrcopy; + int stderrflags; int winchange; /* Set to 1 when a windowchange signal happens */ |