
From: Manfred Spraul <manfred@colorfullife.com>

It assumes that a following write will succeed if less than 256 bytes 
are in the write buffer right now. This assumption is wrong for 
con_write_room: if the console is stopped, it returns 0 bytes buffer 
size (con_write_room()). Dito for pty_write_room.

The attached patch fixes your test case, but I don't understand tty 
devices good enough to guarantee anything.



 drivers/char/n_tty.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

diff -puN drivers/char/n_tty.c~select-xoffed-tty-fix drivers/char/n_tty.c
--- 25/drivers/char/n_tty.c~select-xoffed-tty-fix	2003-07-27 20:47:13.000000000 -0700
+++ 25-akpm/drivers/char/n_tty.c	2003-07-27 20:47:13.000000000 -0700
@@ -1251,7 +1251,8 @@ static unsigned int normal_poll(struct t
 		else
 			tty->minimum_to_wake = 1;
 	}
-	if (tty->driver->chars_in_buffer(tty) < WAKEUP_CHARS)
+	if (tty->driver->chars_in_buffer(tty) < WAKEUP_CHARS &&
+			tty->driver->write_room(tty) > 0)
 		mask |= POLLOUT | POLLWRNORM;
 	return mask;
 }

_
