Notifying readers and select() takes canonical input processing into

account when checking for the number of readable bytes. For readers
it doesn't make a difference, since they were looping anyway, but
select() would report read-availability incorrectly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22379 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2007-09-30 00:52:06 +00:00
parent d5cbcd91b7
commit f0c668a83a
+10 -1
View File
@@ -1099,7 +1099,16 @@ tty_notify_if_available(struct tty *tty, struct tty *otherTTY,
if (!tty)
return;
int32 readable = line_buffer_readable(tty->input_buffer);
// Check, if something is readable (depending on whether canonical input
// processing is enabled).
int32 readable;
if (!tty->is_master && (tty->settings->termios.c_lflag & ICANON) != 0) {
readable = line_buffer_readable_line(tty->input_buffer,
tty->settings->termios.c_cc[VEOL],
tty->settings->termios.c_cc[VEOF]);
} else
readable = line_buffer_readable(tty->input_buffer);
if (readable > 0) {
// if nobody is waiting send select events, otherwise notify the waiter
if (!tty->reader_queue.IsEmpty())