mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-18 21:27:56 +00:00
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:
parent
36be5ec4b0
commit
da5bf709e6
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user