mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:38:11 +00:00
Kernel: Move setting file flags and r/w mode to VFS::open()
Previously, VFS::open() would only use the passed flags for permission checking purposes, and Process::sys$open() would set them on the created FileDescription explicitly. Now, they should be set by VFS::open() on any files being opened, including files that the kernel opens internally. This also lets us get rid of the explicit check for whether or not the returned FileDescription was a preopen fd, and in fact, fixes a bug where a read-only preopen fd without any other flags would be considered freshly opened (due to O_RDONLY being indistinguishable from 0) and granted a new set of flags.
This commit is contained in:
parent
544b8286da
commit
d0d13e2bf5
4 changed files with 10 additions and 12 deletions
|
@ -39,6 +39,7 @@ KResultOr<NonnullRefPtr<FileDescription>> File::open(int options)
|
|||
{
|
||||
auto description = FileDescription::create(*this);
|
||||
description->set_rw_mode(options);
|
||||
description->set_file_flags(options);
|
||||
return description;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue