If the ring buffer is full line_buffer_readable_line() returns the

buffer size in case the buffer does not contain an EOL or EOF. This
prevents readers from waiting infinitely, if canonical input processing
is enabled in that situation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22422 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2007-10-03 19:07:51 +00:00
parent e8429ec9e6
commit 99454e4a90
1 changed files with 3 additions and 1 deletions

View File

@ -63,7 +63,9 @@ line_buffer_readable_line(struct line_buffer &buffer, char eol, char eof)
return i + 1;
}
return 0;
// If the buffer is full, but doesn't contain a EOL or EOF, we report the
// full size anyway, since otherwise the reader would wait forever.
return buffer.in == buffer.size ? buffer.in : 0;
}