mirror of
https://github.com/clearml/dropbear
synced 2025-02-07 13:21:15 +00:00
* Reset the non-blocking status of stdout and stderr as well on exit
--HG-- branch : nonblock-stdout-stderr extra : convert_revision : b33adcc19cf4616e1ec529da774659530dd551f4
This commit is contained in:
parent
2d28663f53
commit
074d8f0a26
@ -113,10 +113,14 @@ static void cli_session_init() {
|
|||||||
cli_ses.tty_raw_mode = 0;
|
cli_ses.tty_raw_mode = 0;
|
||||||
cli_ses.winchange = 0;
|
cli_ses.winchange = 0;
|
||||||
|
|
||||||
/* We store stdin's flags, so we can set them back on exit (otherwise
|
/* We store std{in,out,err}'s flags, so we can set them back on exit
|
||||||
* busybox's ash isn't happy */
|
* (otherwise busybox's ash isn't happy */
|
||||||
cli_ses.stdincopy = dup(STDIN_FILENO);
|
cli_ses.stdincopy = dup(STDIN_FILENO);
|
||||||
cli_ses.stdinflags = fcntl(STDIN_FILENO, F_GETFL, 0);
|
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
|
cli_ses.retval = EXIT_SUCCESS; /* Assume it's clean if we don't get a
|
||||||
specific exit status */
|
specific exit status */
|
||||||
@ -250,9 +254,11 @@ void cli_session_cleanup() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set stdin back to non-blocking - busybox ash dies nastily
|
/* Set std{in,out,err} back to non-blocking - busybox ash dies nastily if
|
||||||
* if we don't revert the flags */
|
* we don't revert the flags */
|
||||||
fcntl(cli_ses.stdincopy, F_SETFL, cli_ses.stdinflags);
|
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();
|
cli_tty_cleanup();
|
||||||
|
|
||||||
|
@ -218,6 +218,10 @@ struct clientsession {
|
|||||||
struct termios saved_tio;
|
struct termios saved_tio;
|
||||||
int stdincopy;
|
int stdincopy;
|
||||||
int stdinflags;
|
int stdinflags;
|
||||||
|
int stdoutcopy;
|
||||||
|
int stdoutflags;
|
||||||
|
int stderrcopy;
|
||||||
|
int stderrflags;
|
||||||
|
|
||||||
int winchange; /* Set to 1 when a windowchange signal happens */
|
int winchange; /* Set to 1 when a windowchange signal happens */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user