diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-06-06 10:41:24 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-06-06 11:00:48 +0200 |
commit | 1f17b40d0031ff960326c6fbd6d8e277f9356560 (patch) | |
tree | c479c07e28e21338fdb682df44a0090549b8a47f /Kernel/FileSystem | |
parent | 6fa727a88ea75a2155996d16d721b5489c2c9085 (diff) | |
download | serenity-1f17b40d0031ff960326c6fbd6d8e277f9356560.zip |
FIFO: Let write() fail with EPIPE if there's no reader.
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r-- | Kernel/FileSystem/FIFO.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/FileSystem/FIFO.cpp b/Kernel/FileSystem/FIFO.cpp index 5851b53ecd..261a3d2d9d 100644 --- a/Kernel/FileSystem/FIFO.cpp +++ b/Kernel/FileSystem/FIFO.cpp @@ -88,7 +88,7 @@ bool FIFO::can_read(FileDescriptor&) const bool FIFO::can_write(FileDescriptor&) const { - return m_buffer.bytes_in_write_buffer() < 4096; + return m_buffer.bytes_in_write_buffer() < 4096 || !m_readers; } ssize_t FIFO::read(FileDescriptor&, byte* buffer, ssize_t size) @@ -108,7 +108,7 @@ ssize_t FIFO::read(FileDescriptor&, byte* buffer, ssize_t size) ssize_t FIFO::write(FileDescriptor&, const byte* buffer, ssize_t size) { if (!m_readers) - return 0; + return -EPIPE; #ifdef FIFO_DEBUG dbgprintf("fifo: write(%p, %u)\n", buffer, size); #endif |