diff options
| author | Alex Richardson <Alexander.Richardson@cl.cam.ac.uk> | 2021-03-19 10:02:41 +0000 |
|---|---|---|
| committer | Alexander Richardson <alexander.richardson@cl.cam.ac.uk> | 2021-09-10 11:35:54 +0000 |
| commit | 382f368a2795cacbe0f3690f9bf5be749f9f0f5e (patch) | |
| tree | 919cca635c9d1372f99c312d3c5f4cabe2e80f05 /src/wayland-os.c | |
| parent | test-helpers: use sysctl() to count open fds on FreeBSD (diff) | |
| download | wayland-382f368a2795cacbe0f3690f9bf5be749f9f0f5e.tar wayland-382f368a2795cacbe0f3690f9bf5be749f9f0f5e.tar.gz wayland-382f368a2795cacbe0f3690f9bf5be749f9f0f5e.tar.bz2 wayland-382f368a2795cacbe0f3690f9bf5be749f9f0f5e.tar.lz wayland-382f368a2795cacbe0f3690f9bf5be749f9f0f5e.tar.xz wayland-382f368a2795cacbe0f3690f9bf5be749f9f0f5e.tar.zst wayland-382f368a2795cacbe0f3690f9bf5be749f9f0f5e.zip | |
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>
Diffstat (limited to 'src/wayland-os.c')
| -rw-r--r-- | src/wayland-os.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/wayland-os.c b/src/wayland-os.c index 44d4e72..27c6035 100644 --- a/src/wayland-os.c +++ b/src/wayland-os.c @@ -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); } |
