aboutsummaryrefslogtreecommitdiff
path: root/xwayland/sockets.c
diff options
context:
space:
mode:
authorGreg V <greg@unrelenting.technology>2017-10-10 01:23:43 +0300
committerGreg V <greg@unrelenting.technology>2017-10-11 00:07:21 +0300
commita5fe9aa73633594b443e2a1a990cdf23addbb28b (patch)
tree561968f504eb29d4f3bf9cd2a3c1ba5d89e44471 /xwayland/sockets.c
parentc39bfe7f84818be9d9901e30ba26db9e8f19c47e (diff)
Add FreeBSD compatibility
Diffstat (limited to 'xwayland/sockets.c')
-rw-r--r--xwayland/sockets.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/xwayland/sockets.c b/xwayland/sockets.c
index 48bcc822..dd732dd7 100644
--- a/xwayland/sockets.c
+++ b/xwayland/sockets.c
@@ -1,4 +1,8 @@
#define _XOPEN_SOURCE 700
+#ifdef __FreeBSD__
+// for SOCK_CLOEXEC
+#define __BSD_VISIBLE 1
+#endif
#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
@@ -65,9 +69,12 @@ static bool open_sockets(int socks[2], int display) {
mkdir(socket_dir, 0777);
- // TODO: non-linux apparently want another format
+#ifdef __linux__
addr.sun_path[0] = 0;
path_size = snprintf(addr.sun_path + 1, sizeof(addr.sun_path) - 1, socket_fmt, display);
+#else
+ path_size = snprintf(addr.sun_path, sizeof(addr.sun_path), socket_fmt, display);
+#endif
socks[0] = open_socket(&addr, path_size);
if (socks[0] < 0) {
return false;