diff options
author | Robin Burchell <robin+git@viroteck.net> | 2019-05-19 10:25:05 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-05-19 14:13:49 +0200 |
commit | d8b74c8c86a0a25ef5fab7d1df3421881f2df03b (patch) | |
tree | ce55b444b4943825bccd840872d620c5c5f94893 /Kernel/Process.cpp | |
parent | 635eb202890e72ced620f8e471bb5025ce67354e (diff) | |
download | serenity-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.cpp | 6 |
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 |