From 311dc3ca7da053bda28df95f3dd8d1b93646e67e Mon Sep 17 00:00:00 2001 From: PulkoMandy Date: Sun, 2 Jul 2023 10:15:45 +0200 Subject: [PATCH] tty: notify read in addition to write when the other tty is closed Reading a tty that's closed by the other side will return an end of file error, but will not block. Fixes #18486. Change-Id: I8441becdcc8c83c08611684fa0a29216e9d04ec8 Reviewed-on: https://review.haiku-os.org/c/haiku/+/6665 Reviewed-by: waddlesplash Tested-by: Commit checker robot --- src/add-ons/kernel/generic/tty/tty.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/add-ons/kernel/generic/tty/tty.cpp b/src/add-ons/kernel/generic/tty/tty.cpp index 6933fd97bb..0d5c962a9a 100644 --- a/src/add-ons/kernel/generic/tty/tty.cpp +++ b/src/add-ons/kernel/generic/tty/tty.cpp @@ -1524,9 +1524,11 @@ tty_close_cookie(tty_cookie* cookie) requestLocker.Unlock(); - // notify a select write event on the other tty, if we've closed this tty - if (cookie->other_tty->open_count > 0) + // notify a select read and write event on the other tty, if we've closed this tty + if (cookie->other_tty->open_count > 0) { tty_notify_select_event(cookie->other_tty, B_SELECT_WRITE); + tty_notify_select_event(cookie->other_tty, B_SELECT_READ); + } cookie->tty->is_exclusive = false; }