summaryrefslogtreecommitdiff
path: root/Kernel/Process.cpp
diff options
context:
space:
mode:
authorRobin Burchell <robin+git@viroteck.net>2019-05-19 10:25:05 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-05-19 14:13:49 +0200
commitd8b74c8c86a0a25ef5fab7d1df3421881f2df03b (patch)
treece55b444b4943825bccd840872d620c5c5f94893 /Kernel/Process.cpp
parent635eb202890e72ced620f8e471bb5025ce67354e (diff)
downloadserenity-d8b74c8c86a0a25ef5fab7d1df3421881f2df03b.zip
Kernel: Check can_write for blocking write
This way the socket write buffer sizes are respected, and things that exceed them get sent EAGAIN.
Diffstat (limited to 'Kernel/Process.cpp')
-rw-r--r--Kernel/Process.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index dff5a9ddf5..af6a8f2911 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -853,8 +853,10 @@ ssize_t Process::sys$writev(int fd, const struct iovec* iov, int iov_count)
ssize_t Process::do_write(FileDescriptor& descriptor, const byte* data, int data_size)
{
ssize_t nwritten = 0;
- if (!descriptor.is_blocking())
- return descriptor.write(data, data_size);
+ if (!descriptor.is_blocking()) {
+ if (!descriptor.can_write())
+ return -EAGAIN;
+ }
while (nwritten < data_size) {
#ifdef IO_DEBUG