Skip to content
  • Pekka Paalanen's avatar
    os: wrap recvmsg(MSG_CMSG_CLOEXEC) · 35d5053c
    Pekka Paalanen authored
    
    
    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: Pekka Paalanen's avatarPekka Paalanen <ppaalanen@gmail.com>
    35d5053c