aboutsummaryrefslogtreecommitdiffstats
path: root/src/wayland-os.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wayland-os.c')
-rw-r--r--src/wayland-os.c11
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);
}