Consider count_in in Noux terminal-read function
It does not suffice to constrain the amount of returned data with chunk size of the transport buffer because the client may have specified an even smaller value. For example, libreadline reads single characters from the terminal and expects a single character in return. A different amount is interpreted as EOF.
This commit is contained in:
@@ -64,9 +64,12 @@ namespace Noux {
|
||||
return false;
|
||||
}
|
||||
|
||||
Genode::size_t count = terminal.read(sysio->read_out.chunk,
|
||||
sizeof(sysio->read_out.chunk));
|
||||
sysio->read_out.count = count;
|
||||
Genode::size_t const max_count =
|
||||
Genode::min(sysio->read_in.count,
|
||||
sizeof(sysio->read_out.chunk));
|
||||
|
||||
sysio->read_out.count =
|
||||
terminal.read(sysio->read_out.chunk, max_count);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user