mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 11:46:19 +00:00
n_tty: do O_ONLCR translation as a single write
When translating CR to CRNL in the n_tty line discipline, we did it as
two tty_put_char() calls. Which works, but is stupid, and has caused
problems before too with bad interactions with the write_room() logic.
The generic USB serial driver had that problem, for example.
Now the pty layer had similar issues after being moved to the generic
tty buffering code (in commit d945cb9cce
:
"pty: Rework the pty layer to use the normal buffering logic").
So stop doing the silly separate two writes, and do it as a single write
instead. That's what the n_tty layer already does for the space
expansion of tabs (XTABS), and it means that we'll now always have just
a single write for the CRNL to match the single 'tty_write_room()' test,
which hopefully means that the next time somebody screws up buffering,
it won't cause weeks of debugging.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
a2a8474c3f
commit
37f81fa1f6
1 changed files with 1 additions and 2 deletions
|
@ -300,8 +300,7 @@ static int do_output_char(unsigned char c, struct tty_struct *tty, int space)
|
|||
if (space < 2)
|
||||
return -1;
|
||||
tty->canon_column = tty->column = 0;
|
||||
tty_put_char(tty, '\r');
|
||||
tty_put_char(tty, c);
|
||||
tty->ops->write(tty, "\r\n", 2);
|
||||
return 2;
|
||||
}
|
||||
tty->canon_column = tty->column;
|
||||
|
|
Loading…
Reference in a new issue