stdout flush

Richard Kojedzinszky krichy at
Sun Sep 12 20:20:56 EST 2004

Dear all,

I compiled openssh-3.9p1 against uClibc on linux, and when I logged in to
a system using this openssh, the /etc/motd didn't appear. I have checked
everyhing, and made some debugging. As I have seen, session.c prepares the
environment, and invokes the user's login shell, but before the execv()
call, does not flush the stdout. And if I made it do to it, it began to
work. I dont know if it is the right solution, or I am doing something

A little patch that puts that fflush in is attached.

Please send mail directly me, as I am not subscribed to this list.

Kojedzinszky Richard
TvNetWork Rt.
E-mail: krichy at
PGP: 0x24E79141
  Fingerprint = 6847 ECFF EF58 0C09 18A5  16CF 270F 0C6F 24E7 9141
-------------- next part --------------
--- openssh-3.9p1/session.c.orig	Wed Sep  1 16:36:39 2004
+++ openssh-3.9p1/session.c	Wed Sep  1 16:50:16 2004
@@ -1521,6 +1521,11 @@
 		shell0 = shell;
+	/* flush all output streams to get
+	 * everything written on the terminal
+	 * like motd, and etc */
+	fflush(NULL);
 	 * If we have no command, execute the shell.  In this case, the shell
 	 * name to be passed in argv[0] is preceded by '-' to indicate that

More information about the openssh-unix-dev mailing list