diff options
author | Greg V <greg@unrelenting.technology> | 2017-11-22 15:17:10 +0300 |
---|---|---|
committer | Greg V <greg@unrelenting.technology> | 2017-11-22 15:17:10 +0300 |
commit | 71aa634ac501389b5c0c02fa0fed2ea08ca9f350 (patch) | |
tree | 885cfe012cdf39470e922cbdad358db1f515c9e9 /xwayland/sockets.c | |
parent | e6bf92cf02be8587e14d32f214467b09da40d9ff (diff) |
Fix Xwayland second socket path on non-Linux systems
It was creating two sockets with the same path
Diffstat (limited to 'xwayland/sockets.c')
-rw-r--r-- | xwayland/sockets.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/xwayland/sockets.c b/xwayland/sockets.c index dd732dd7..1bddd20f 100644 --- a/xwayland/sockets.c +++ b/xwayland/sockets.c @@ -21,6 +21,7 @@ static const char *lock_fmt = "/tmp/.X%d-lock"; static const char *socket_dir = "/tmp/.X11-unix"; static const char *socket_fmt = "/tmp/.X11-unix/X%d"; +static const char *socket_fmt2 = "/tmp/.X11-unix/X%d_"; static int open_socket(struct sockaddr_un *addr, size_t path_size) { int fd, rc; @@ -73,7 +74,7 @@ static bool open_sockets(int socks[2], int display) { 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); + path_size = snprintf(addr.sun_path, sizeof(addr.sun_path), socket_fmt2, display); #endif socks[0] = open_socket(&addr, path_size); if (socks[0] < 0) { @@ -97,6 +98,11 @@ void unlink_display_sockets(int display) { snprintf(sun_path, sizeof(sun_path), socket_fmt, display); unlink(sun_path); +#ifndef __linux__ + snprintf(sun_path, sizeof(sun_path), socket_fmt2, display); + unlink(sun_path); +#endif + snprintf(sun_path, sizeof(sun_path), lock_fmt, display); unlink(sun_path); } |