From fb4a20ade59d954b2708cf756dd92363053220d0 Mon Sep 17 00:00:00 2001 From: Aman Singh Date: Thu, 13 Jul 2023 22:17:23 +0530 Subject: [PATCH] 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 --- Kernel/TTY/MasterPTY.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel/TTY/MasterPTY.cpp b/Kernel/TTY/MasterPTY.cpp index f4c8652a8b..6385f0f40a 100644 --- a/Kernel/TTY/MasterPTY.cpp +++ b/Kernel/TTY/MasterPTY.cpp @@ -96,7 +96,7 @@ bool MasterPTY::can_write_from_slave() const { if (m_closed) return true; - return m_buffer->space_for_writing(); + return m_buffer->space_for_writing() >= 2; } ErrorOr MasterPTY::close()