summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-01-24 08:31:18 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-24 08:32:09 +0100
commit2112b799864318045e33783709cc3179e6db48e6 (patch)
tree845d547da514aeaa4ae4ca3dc6e64e472ce36fc9 /Kernel/FileSystem
parent50a2cb38e5498079707f786a9fdf381d448fefd0 (diff)
downloadserenity-2112b799864318045e33783709cc3179e6db48e6.zip
Revert "Kernel: Make VFS::create() fail with EINVAL on invalid file mode"
This reverts commit ca3489eec7c1c7910407c4872ed6d70c92ce50cf. Fixes #5087.
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r--Kernel/FileSystem/VirtualFileSystem.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp
index aa7b94571a..25029dc021 100644
--- a/Kernel/FileSystem/VirtualFileSystem.cpp
+++ b/Kernel/FileSystem/VirtualFileSystem.cpp
@@ -389,8 +389,10 @@ KResultOr<NonnullRefPtr<FileDescription>> VFS::create(StringView path, int optio
if (result.is_error())
return result;
- if (!is_regular_file(mode) && !is_socket(mode) && !is_fifo(mode) && !is_block_device(mode) && !is_character_device(mode))
- return EINVAL;
+ 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;
+ }
auto& parent_inode = parent_custody.inode();
auto current_process = Process::current();