mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:28:12 +00:00
FIFO: Raise SIGPIPE in processes that write() to a broken pipe.
This commit is contained in:
parent
abb3643d88
commit
e4cfa9a686
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue