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.
This commit is contained in:
Kristian Høgsberg 2010-12-01 15:36:20 -05:00
parent 0611e3efc2
commit 2bb3ebe1e4
11 changed files with 99 additions and 51 deletions

View file

@ -513,8 +513,6 @@ wayland_compositor_create(struct wl_display *display, int width, int height)
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 @@ wayland_compositor_create(struct wl_display *display, int width, int height)
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");