Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Inet] Fix setting for CLOEXEC flag at socket creation (#33164)
* [Inet] Fix setting for SOCK_CLOEXEC The linux kernel allows to set the flag SOCK_CLOEXEC through the parameter type[1]. The implementation sets the flag through the parameter protocol and causes the call to socket()[2] to return -1 with EINVAL. This fixes the behaviour by OR-ing the flag SOCK_CLOEXEC to type instead of protocol. [1]: https://github.com/torvalds/linux/blob/v6.8/net/socket.c#L1655 [2]: https://man7.org/linux/man-pages/man2/socket.2.html * [Inet] Fix setting for O_CLOEXEC The macro O_CLOEXEC is a filedescriptor flag. The implemention sets the flag O_CLOEXEC as the parameter command given to function fcntl[1] and causes the call to fcntl to return -1 with EINVAL. The flag O_CLOEXEC intends to be set using the command F_SETFD. This fixes the behaviour by adding the missing command paramete F_SETFD before the optional argument O_CLOEXEC. [1]: https://man7.org/linux/man-pages/man2/fcntl.2.html
- Loading branch information