diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-02-14 14:38:30 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-02-14 14:38:30 +0100 |
commit | 77177dbb767259a6135347f88a2bf78cc4ea72bd (patch) | |
tree | 6e932c4db5ca6c44919e0da844eccbcb1c256316 /Kernel/VirtualFileSystem.cpp | |
parent | 2f35e54f80a3e94319ee4157e6d8be666a303eaf (diff) | |
download | serenity-77177dbb767259a6135347f88a2bf78cc4ea72bd.zip |
Kernel: Begin fleshing out bind() syscall.
Diffstat (limited to 'Kernel/VirtualFileSystem.cpp')
-rw-r--r-- | Kernel/VirtualFileSystem.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Kernel/VirtualFileSystem.cpp b/Kernel/VirtualFileSystem.cpp index ff630ed572..ed6f060de3 100644 --- a/Kernel/VirtualFileSystem.cpp +++ b/Kernel/VirtualFileSystem.cpp @@ -134,11 +134,16 @@ RetainPtr<FileDescriptor> VFS::open(const String& path, int& error, int options, { auto inode_id = resolve_path(path, base.identifier(), error, options); auto inode = get_inode(inode_id); - if (!inode) { - if (options & O_CREAT) + if (options & O_CREAT) { + if (!inode) return create(path, error, options, mode, base); - return nullptr; + else if (options & O_EXCL) { + error = -EEXIST; + return nullptr; + } } + if (!inode) + return nullptr; auto metadata = inode->metadata(); if (!(options & O_DONT_OPEN_DEVICE) && metadata.is_character_device()) { auto it = m_character_devices.find(encoded_device(metadata.major_device, metadata.minor_device)); |