mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:57:43 +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())
|
if (result.is_error())
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
if (!is_socket(mode) && !is_fifo(mode) && !is_block_device(mode) && !is_character_device(mode)) {
|
if (!is_regular_file(mode) && !is_socket(mode) && !is_fifo(mode) && !is_block_device(mode) && !is_character_device(mode))
|
||||||
// Turn it into a regular file. (This feels rather hackish.)
|
return EINVAL;
|
||||||
mode |= 0100000;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& parent_inode = parent_custody.inode();
|
auto& parent_inode = parent_custody.inode();
|
||||||
auto current_process = Process::current();
|
auto current_process = Process::current();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue