Skip to content
Commit 35d5053c authored by Pekka Paalanen's avatar Pekka Paalanen
Browse files

os: wrap recvmsg(MSG_CMSG_CLOEXEC)



Some system C libraries do not have MSG_CMSG_CLOEXEC. This flag would
automatically set O_CLOEXEC flag on any received file descriptors.

Provide a fallback that does it manually. If setting CLOEXEC fails, the
file descriptor is closed immediately, which will lead to failures but
avoid leaks. However, setting CLOEXEC is not really expected to fail
occasionally.

Add tests for the wrapper. The setup is copied from connection-test.c.

Signed-off-by: default avatarPekka Paalanen <ppaalanen@gmail.com>
parent 2ccaf918
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment