# HG changeset patch # User Matt Johnston # Date 1110715407 0 # Node ID 058cc78926362182adba4cc1c0c26ece30d4d7f8 # Parent 2c5741e4b85514d50ba343fa571df77957f103cc# Parent 2098857ab826dd42ae05a9a22c3ce2cc835b9844 propagate from branch 'au.asn.ucc.matt.dropbear.nonblock-stdout-stderr' (head 0aee4615c96aea0526736b394455958c1fbb47c9) to branch 'au.asn.ucc.matt.dropbear' (head dff46fd69e33acd167e41dfd18b948a82c5489d1) diff -r 2098857ab826 -r 058cc7892636 cli-session.c --- a/cli-session.c Mon Mar 07 04:25:43 2005 +0000 +++ b/cli-session.c Sun Mar 13 12:03:27 2005 +0000 @@ -113,10 +113,14 @@ 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 @@ 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(); diff -r 2098857ab826 -r 058cc7892636 session.h --- a/session.h Mon Mar 07 04:25:43 2005 +0000 +++ b/session.h Sun Mar 13 12:03:27 2005 +0000 @@ -218,6 +218,10 @@ 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 */