mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-28 05:52:53 +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
Notes:
sideshowbarker
2024-07-19 15:51:24 +09:00
Author: https://github.com/awesomekling
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