diff options
author | Itamar <itamar8910@gmail.com> | 2021-03-29 15:27:38 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-29 19:56:54 +0200 |
commit | ba0df276535d62b33330bac0c0c03c147c8ee606 (patch) | |
tree | 202d3a3465fef9fb9c8fd00d8f9eb2d9ec8c8212 /Kernel/Syscalls | |
parent | 9eaa6527f73b9e219c93b895a9f32684f7f875f4 (diff) | |
download | serenity-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.cpp | 2 |
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(); |