The unified diff between revisions [63530dac..] and [e99d4659..] is displayed below. It can also be downloaded as a raw diff.

This diff has been restricted to the following files: 'cli-session.c'

#
#
# patch "cli-session.c"
#  from [044e633a29f6fea152646a63193851598f5d0b4d]
#    to [456ed9269b52604e2d0c8aa700ba987974d0fd7b]
#
============================================================
--- cli-session.c	044e633a29f6fea152646a63193851598f5d0b4d
+++ cli-session.c	456ed9269b52604e2d0c8aa700ba987974d0fd7b
@@ -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();