Create socket in /var/run/user/${HOME}
Use the runtime dir from XDG Base Directory Specification for creating the
socket in a directory only the user can read and write.
diff --git a/compositor/compositor-wayland.c b/compositor/compositor-wayland.c
index 98c675b..e289a29 100644
--- a/compositor/compositor-wayland.c
+++ b/compositor/compositor-wayland.c
@@ -513,8 +513,6 @@
struct wayland_compositor *c;
struct wl_event_loop *loop;
int fd;
- char *socket_name, *env;
- int socket_name_size;
c = malloc(sizeof *c);
if (c == NULL)
@@ -522,11 +520,7 @@
memset(c, 0, sizeof *c);
- env = getenv("WAYLAND_DISPLAY");
- socket_name_size = asprintf(&socket_name, "%c%s", '\0', env) + 1;
-
- c->parent.display = wl_display_connect(socket_name, socket_name_size);
- free(socket_name);
+ c->parent.display = wl_display_connect(NULL);
if (c->parent.display == NULL) {
fprintf(stderr, "failed to create display: %m\n");