Mercurial > dropbear
comparison cli-session.c @ 175:2c5741e4b855 nonblock-stdout-stderr
* Reset the non-blocking status of stdout and stderr as well on exit
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 02 Mar 2005 04:14:26 +0000 |
parents | 0cfba3034be5 |
children | aad4b3f58556 |
comparison
equal
deleted
inserted
replaced
174:c753db8eb446 | 175:2c5741e4b855 |
---|---|
111 cli_ses.kex_state = KEX_NOTHING; | 111 cli_ses.kex_state = KEX_NOTHING; |
112 | 112 |
113 cli_ses.tty_raw_mode = 0; | 113 cli_ses.tty_raw_mode = 0; |
114 cli_ses.winchange = 0; | 114 cli_ses.winchange = 0; |
115 | 115 |
116 /* We store stdin's flags, so we can set them back on exit (otherwise | 116 /* We store std{in,out,err}'s flags, so we can set them back on exit |
117 * busybox's ash isn't happy */ | 117 * (otherwise busybox's ash isn't happy */ |
118 cli_ses.stdincopy = dup(STDIN_FILENO); | 118 cli_ses.stdincopy = dup(STDIN_FILENO); |
119 cli_ses.stdinflags = fcntl(STDIN_FILENO, F_GETFL, 0); | 119 cli_ses.stdinflags = fcntl(STDIN_FILENO, F_GETFL, 0); |
120 cli_ses.stdoutcopy = dup(STDOUT_FILENO); | |
121 cli_ses.stdoutflags = fcntl(STDOUT_FILENO, F_GETFL, 0); | |
122 cli_ses.stderrcopy = dup(STDERR_FILENO); | |
123 cli_ses.stderrflags = fcntl(STDERR_FILENO, F_GETFL, 0); | |
120 | 124 |
121 cli_ses.retval = EXIT_SUCCESS; /* Assume it's clean if we don't get a | 125 cli_ses.retval = EXIT_SUCCESS; /* Assume it's clean if we don't get a |
122 specific exit status */ | 126 specific exit status */ |
123 | 127 |
124 /* Auth */ | 128 /* Auth */ |
248 | 252 |
249 if (!sessinitdone) { | 253 if (!sessinitdone) { |
250 return; | 254 return; |
251 } | 255 } |
252 | 256 |
253 /* Set stdin back to non-blocking - busybox ash dies nastily | 257 /* Set std{in,out,err} back to non-blocking - busybox ash dies nastily if |
254 * if we don't revert the flags */ | 258 * we don't revert the flags */ |
255 fcntl(cli_ses.stdincopy, F_SETFL, cli_ses.stdinflags); | 259 fcntl(cli_ses.stdincopy, F_SETFL, cli_ses.stdinflags); |
260 fcntl(cli_ses.stdoutcopy, F_SETFL, cli_ses.stdoutflags); | |
261 fcntl(cli_ses.stderrcopy, F_SETFL, cli_ses.stderrflags); | |
256 | 262 |
257 cli_tty_cleanup(); | 263 cli_tty_cleanup(); |
258 | 264 |
259 } | 265 } |
260 | 266 |