diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2020-01-19 01:04:48 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-01-18 23:51:22 +0100 |
commit | 6466c3d750da0ddc46498c4e90f8ff8b0972ca65 (patch) | |
tree | 5dca8192e86dea86fb0d1f5273dcda83b5fc5dce /Kernel/Net | |
parent | 7d4a2675042a7ea982f604512f25c2f81a7e87df (diff) | |
download | serenity-6466c3d750da0ddc46498c4e90f8ff8b0972ca65.zip |
Kernel: Pass correct permission flags when opening files
Right now, permission flags passed to VFS::open() are effectively ignored, but
that is going to change.
* O_RDONLY is 0, but it's still nicer to pass it explicitly
* POSIX says that binding a Unix socket to a symlink shall fail with EADDRINUSE
Diffstat (limited to 'Kernel/Net')
-rw-r--r-- | Kernel/Net/LocalSocket.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp index c49f363985..48c6fbfb31 100644 --- a/Kernel/Net/LocalSocket.cpp +++ b/Kernel/Net/LocalSocket.cpp @@ -111,7 +111,7 @@ KResult LocalSocket::bind(const sockaddr* user_address, socklen_t address_size) mode_t mode = S_IFSOCK | (m_prebind_mode & 04777); UidAndGid owner { m_prebind_uid, m_prebind_gid }; - auto result = VFS::the().open(path, O_CREAT | O_EXCL, mode, current->process().current_directory(), owner); + auto result = VFS::the().open(path, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW_NOERROR, mode, current->process().current_directory(), owner); if (result.is_error()) { if (result.error() == -EEXIST) return KResult(-EADDRINUSE); @@ -145,7 +145,7 @@ KResult LocalSocket::connect(FileDescription& description, const sockaddr* addre kprintf("%s(%u) LocalSocket{%p} connect(%s)\n", current->process().name().characters(), current->pid(), this, safe_address); #endif - auto description_or_error = VFS::the().open(safe_address, 0, 0, current->process().current_directory()); + auto description_or_error = VFS::the().open(safe_address, O_RDWR, 0, current->process().current_directory()); if (description_or_error.is_error()) return KResult(-ECONNREFUSED); |