diff options
| author | Jasper St. Pierre <jstpierre@mecheye.net> | 2014-05-08 10:24:06 -0400 |
|---|---|---|
| committer | Jasper St. Pierre <jstpierre@mecheye.net> | 2014-08-05 15:42:59 -0400 |
| commit | 6e8a6624030df0ac7656f8743ca537c1414ada0f (patch) | |
| tree | eadae9d14b897916f1e144ae3349ce400b7928c2 | |
| parent | server: Clean up socket destruction (diff) | |
| download | wayland-6e8a6624030df0ac7656f8743ca537c1414ada0f.tar wayland-6e8a6624030df0ac7656f8743ca537c1414ada0f.tar.gz wayland-6e8a6624030df0ac7656f8743ca537c1414ada0f.tar.bz2 wayland-6e8a6624030df0ac7656f8743ca537c1414ada0f.tar.lz wayland-6e8a6624030df0ac7656f8743ca537c1414ada0f.tar.xz wayland-6e8a6624030df0ac7656f8743ca537c1414ada0f.tar.zst wayland-6e8a6624030df0ac7656f8743ca537c1414ada0f.zip | |
server: Create the socket FD after taking the lock
We're going to split out the lock-taking to another function so we
can repetitively try locks.
| -rw-r--r-- | src/wayland-server.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/wayland-server.c b/src/wayland-server.c index 019961e..eb6a3c5 100644 --- a/src/wayland-server.c +++ b/src/wayland-server.c @@ -1083,12 +1083,6 @@ wl_display_add_socket(struct wl_display *display, const char *name) if (s == NULL) return -1; - s->fd = wl_os_socket_cloexec(PF_LOCAL, SOCK_STREAM, 0); - if (s->fd < 0) { - wl_socket_destroy(s); - return -1; - } - if (name == NULL) name = getenv("WAYLAND_DISPLAY"); if (name == NULL) @@ -1115,6 +1109,12 @@ wl_display_add_socket(struct wl_display *display, const char *name) return -1; } + s->fd = wl_os_socket_cloexec(PF_LOCAL, SOCK_STREAM, 0); + if (s->fd < 0) { + wl_socket_destroy(s); + return -1; + } + size = offsetof (struct sockaddr_un, sun_path) + name_size; if (bind(s->fd, (struct sockaddr *) &s->addr, size) < 0) { wl_log("bind() failed with error: %m\n"); |
