diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-06-06 10:54:26 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-06-06 11:00:48 +0200 |
commit | e4cfa9a68686e4f9e78543312224874f089f4723 (patch) | |
tree | 291feff7a2c00940bf8973e75b14202e684125b7 /Kernel/FileSystem | |
parent | abb3643d886210e41adff642a98afde49f09d3dc (diff) | |
download | serenity-e4cfa9a68686e4f9e78543312224874f089f4723.zip |
FIFO: Raise SIGPIPE in processes that write() to a broken pipe.
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r-- | Kernel/FileSystem/FIFO.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Kernel/FileSystem/FIFO.cpp b/Kernel/FileSystem/FIFO.cpp index 261a3d2d9d..344dcee87e 100644 --- a/Kernel/FileSystem/FIFO.cpp +++ b/Kernel/FileSystem/FIFO.cpp @@ -1,6 +1,8 @@ #include <Kernel/FileSystem/FIFO.h> #include <Kernel/FileSystem/FileDescriptor.h> #include <Kernel/Lock.h> +#include <Kernel/Process.h> +#include <Kernel/Thread.h> #include <AK/StdLibExtras.h> #include <AK/HashTable.h> @@ -107,8 +109,10 @@ ssize_t FIFO::read(FileDescriptor&, byte* buffer, ssize_t size) ssize_t FIFO::write(FileDescriptor&, const byte* buffer, ssize_t size) { - if (!m_readers) + if (!m_readers) { + current->process().send_signal(SIGPIPE, ¤t->process()); return -EPIPE; + } #ifdef FIFO_DEBUG dbgprintf("fifo: write(%p, %u)\n", buffer, size); #endif |