mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 18:15:07 +00:00
Kernel: Make VFS::create() fail with EINVAL on invalid file mode
Instead of trying to fix up the mode to look like a regular file, just fail instead.
This commit is contained in:
parent
bfb254ed14
commit
ca3489eec7
1 changed files with 2 additions and 4 deletions
|
@ -389,10 +389,8 @@ KResultOr<NonnullRefPtr<FileDescription>> VFS::create(StringView path, int optio
|
|||
if (result.is_error())
|
||||
return result;
|
||||
|
||||
if (!is_socket(mode) && !is_fifo(mode) && !is_block_device(mode) && !is_character_device(mode)) {
|
||||
// Turn it into a regular file. (This feels rather hackish.)
|
||||
mode |= 0100000;
|
||||
}
|
||||
if (!is_regular_file(mode) && !is_socket(mode) && !is_fifo(mode) && !is_block_device(mode) && !is_character_device(mode))
|
||||
return EINVAL;
|
||||
|
||||
auto& parent_inode = parent_custody.inode();
|
||||
auto current_process = Process::current();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue