kernel: Return SIGPIPE/EPIPE when writing to a pipe with no more readers

This commit is contained in:
apio 2023-08-15 19:08:37 +02:00
parent 1e68ac7312
commit 706752d6b9
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

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