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 <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This commit is contained in:
PulkoMandy 2023-07-02 10:15:45 +02:00 committed by Adrien Destugues
parent 037c2257f9
commit 311dc3ca7d

View File

@ -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;
}