From ba0df276535d62b33330bac0c0c03c147c8ee606 Mon Sep 17 00:00:00 2001 From: Itamar Date: Mon, 29 Mar 2021 15:27:38 +0300 Subject: [PATCH] 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. --- Kernel/Syscalls/write.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 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();