1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +00:00

Kernel: Reading from a slave PTY should give EOF if master PTY is closed.

This commit is contained in:
Andreas Kling 2019-02-05 12:27:32 +01:00
parent 3accdb0e93
commit 378e20c535
5 changed files with 35 additions and 7 deletions

View file

@ -43,6 +43,20 @@ bool SlavePTY::can_write(Process&) const
return m_master->can_write_from_slave();
}
bool SlavePTY::can_read(Process& process) const
{
if (m_master->is_closed())
return true;
return TTY::can_read(process);
}
ssize_t SlavePTY::read(Process& process, byte* buffer, size_t size)
{
if (m_master->is_closed())
return 0;
return TTY::read(process, buffer, size);
}
void SlavePTY::close()
{
m_master->notify_slave_closed(Badge<SlavePTY>());