summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2021-03-29 15:27:38 +0300
committerAndreas Kling <kling@serenityos.org>2021-03-29 19:56:54 +0200
commitba0df276535d62b33330bac0c0c03c147c8ee606 (patch)
tree202d3a3465fef9fb9c8fd00d8f9eb2d9ec8c8212 /Kernel/Syscalls
parent9eaa6527f73b9e219c93b895a9f32684f7f875f4 (diff)
downloadserenity-ba0df276535d62b33330bac0c0c03c147c8ee606.zip
Kernel: Support write() after setting O_APPEND on a non-seekable file
Previously, Process::do_write would error if the O_APPEND flag was set on a non-seekable file. Other systems (such as Linux) seem to be OK with doing this, so we now do not attempt to seek to the end the file if it's not seekable.
Diffstat (limited to 'Kernel/Syscalls')
-rw-r--r--Kernel/Syscalls/write.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/Syscalls/write.cpp b/Kernel/Syscalls/write.cpp
index 2543557638..536d166522 100644
--- a/Kernel/Syscalls/write.cpp
+++ b/Kernel/Syscalls/write.cpp
@@ -84,7 +84,7 @@ KResultOr<ssize_t> Process::do_write(FileDescription& description, const UserOrK
return EAGAIN;
}
- if (description.should_append()) {
+ if (description.should_append() && description.file().is_seekable()) {
auto seek_result = description.seek(0, SEEK_END);
if (seek_result.is_error())
return seek_result.error();