1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:07:36 +00:00

Kernel: Fix condition for write to succeed on pseudoterminal

As "\n" is translated to "\r\n" in TTYs, the condition for a write
to succeed on a pseudoterminal should check if the underlying buffer
has 2 bytes empty rather than 1.

Fixes SerenityOS#18888
This commit is contained in:
Aman Singh 2023-07-13 22:17:23 +05:30 committed by Tim Schumacher
parent d7c1a1ecac
commit fb4a20ade5

View file

@ -96,7 +96,7 @@ bool MasterPTY::can_write_from_slave() const
{ {
if (m_closed) if (m_closed)
return true; return true;
return m_buffer->space_for_writing(); return m_buffer->space_for_writing() >= 2;
} }
ErrorOr<void> MasterPTY::close() ErrorOr<void> MasterPTY::close()