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.
This commit is contained in:
Itamar 2021-03-29 15:27:38 +03:00 committed by Andreas Kling
parent 9eaa6527f7
commit ba0df27653

View file

@ -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();