mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-05 13:29:50 -05:00
Detect FreeBSD versions with broken MSG_CMSG_CLOEXEC
If we are compiling against a version of FreeBSD where MSG_CMSG_CLOEXEC does not work, use the fallback directly. This was only fixed recently (in https://cgit.freebsd.org/src/commit/?id=6ceacebdf52211). Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
This commit is contained in:
parent
42bf011f65
commit
382f368a27
3 changed files with 33 additions and 1 deletions
|
|
@ -168,6 +168,15 @@ recvmsg_cloexec_fallback(int sockfd, struct msghdr *msg, int flags)
|
|||
ssize_t
|
||||
wl_os_recvmsg_cloexec(int sockfd, struct msghdr *msg, int flags)
|
||||
{
|
||||
#if HAVE_BROKEN_MSG_CMSG_CLOEXEC
|
||||
/*
|
||||
* FreeBSD had a broken implementation of MSG_CMSG_CLOEXEC between 2015
|
||||
* and 2021, so we have to use the non-MSG_CMSG_CLOEXEC fallback
|
||||
* directly when compiling against a version that does not include the
|
||||
* fix (https://cgit.freebsd.org/src/commit/?id=6ceacebdf52211).
|
||||
*/
|
||||
#pragma message("Using fallback directly since MSG_CMSG_CLOEXEC is broken.")
|
||||
#else
|
||||
ssize_t len;
|
||||
|
||||
len = recvmsg(sockfd, msg, flags | MSG_CMSG_CLOEXEC);
|
||||
|
|
@ -175,7 +184,7 @@ wl_os_recvmsg_cloexec(int sockfd, struct msghdr *msg, int flags)
|
|||
return len;
|
||||
if (errno != EINVAL)
|
||||
return -1;
|
||||
|
||||
#endif
|
||||
return recvmsg_cloexec_fallback(sockfd, msg, flags);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue