kernel: Return SIGPIPE/EPIPE when writing to a pipe with no more readers
This commit is contained in:
parent
1e68ac7312
commit
706752d6b9
@ -44,7 +44,11 @@ Result<usize> Pipe::read(u8* buf, usize, usize length)
|
||||
|
||||
Result<usize> Pipe::write(const u8* buf, usize, usize length)
|
||||
{
|
||||
if (!m_reader) return length;
|
||||
if (!m_reader)
|
||||
{
|
||||
Scheduler::current()->send_signal(SIGPIPE);
|
||||
return err(EPIPE);
|
||||
}
|
||||
|
||||
u8* slice = TRY(m_data_buffer.slice_at_end(length));
|
||||
memcpy(slice, buf, length);
|
||||
|
Loading…
Reference in New Issue
Block a user