mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 19:57:45 +03:00
Kernel: Accepted socket file descriptors should not inherit flags
For example Linux accepts an additional argument for flags in accept4() that let the user specify what flags they want. However, by default accept() should not inherit those flags from the listener socket.
This commit is contained in:
parent
7a1d09ef1a
commit
3c0355a398
Notes:
sideshowbarker
2024-07-18 18:52:41 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/3c0355a398b Pull-request: https://github.com/SerenityOS/serenity/pull/6752
@ -125,10 +125,7 @@ KResultOr<int> Process::sys$accept(int accepting_socket_fd, Userspace<sockaddr*>
|
||||
|
||||
accepted_socket_description_result.value()->set_readable(true);
|
||||
accepted_socket_description_result.value()->set_writable(true);
|
||||
// NOTE: The accepted socket inherits fd flags from the accepting socket.
|
||||
// I'm not sure if this matches other systems but it makes sense to me.
|
||||
accepted_socket_description_result.value()->set_blocking(accepting_socket_description->is_blocking());
|
||||
m_fds[accepted_socket_fd].set(accepted_socket_description_result.release_value(), m_fds[accepting_socket_fd].flags());
|
||||
m_fds[accepted_socket_fd].set(accepted_socket_description_result.release_value(), 0);
|
||||
|
||||
// NOTE: Moving this state to Completed is what causes connect() to unblock on the client side.
|
||||
accepted_socket->set_setup_state(Socket::SetupState::Completed);
|
||||
|
Loading…
Reference in New Issue
Block a user