[PATCH] getty: Wait until all output written to stdout has been transmitted

Michal Simek monstr at monstr.eu
Thu Jan 20 08:54:23 UTC 2011

Problem was observed on a Xilinx Microblaze system with console on mdm
IP (which is very slow), where part of the console output wasn't shown.

Calling tcdrain() instead of tcflush() fixes the problem.

Signed-off-by: Peter Korsgaard <jacmet at gmail.com>
Signed-off-by: Michal Simek <monstr at monstr.eu>
 loginutils/getty.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/loginutils/getty.c b/loginutils/getty.c
index 0f5e333..79c278f 100644
--- a/loginutils/getty.c
+++ b/loginutils/getty.c
@@ -266,8 +266,8 @@ static void termios_init(struct termios *tp, int speed)
 	 * reads will be done in raw mode anyway. Errors will be dealt with
 	 * later on.
-	/* flush input and output queues, important for modems! */
-	tcflush(0, TCIOFLUSH);
+	/* wait until all output written to the stdout has been transmitted */
+	tcdrain(STDOUT_FILENO);
 	ispeed = ospeed = speed;
 	if (speed == B0) {
 		/* Speed was specified as "0" on command line.

More information about the busybox mailing list