mirror of
https://github.com/RGBCube/serenity
synced 2025-07-07 16:37:34 +00:00
Kernel: Writing to a slave PTY should yield EIO if the master is closed.
This commit is contained in:
parent
2a0700af9a
commit
0669ef8977
7 changed files with 14 additions and 8 deletions
|
@ -61,13 +61,18 @@ void MasterPTY::notify_slave_closed(Badge<SlavePTY>)
|
|||
m_slave = nullptr;
|
||||
}
|
||||
|
||||
void MasterPTY::on_slave_write(const byte* data, size_t size)
|
||||
ssize_t MasterPTY::on_slave_write(const byte* data, size_t size)
|
||||
{
|
||||
if (m_closed)
|
||||
return -EIO;
|
||||
m_buffer.write(data, size);
|
||||
return size;
|
||||
}
|
||||
|
||||
bool MasterPTY::can_write_from_slave() const
|
||||
{
|
||||
if (m_closed)
|
||||
return true;
|
||||
return m_buffer.bytes_in_write_buffer() < 4096;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue