[PATCH 1/5] server: Create socket path prior the socket
Benjamin Franzke
benjaminfranzke at googlemail.com
Wed Feb 27 03:10:16 PST 2013
This is just in preparation for systemd socket activation
since we need to know the path before creating/acquiring the socket.
---
src/wayland-server.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/wayland-server.c b/src/wayland-server.c
index dae7177..fb07a01 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -1314,12 +1314,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) {
- free(s);
- return -1;
- }
-
if (name == NULL)
name = getenv("WAYLAND_DISPLAY");
if (name == NULL)
@@ -1334,7 +1328,6 @@ wl_display_add_socket(struct wl_display *display, const char *name)
if (name_size > (int)sizeof s->addr.sun_path) {
wl_log("error: socket path \"%s/%s\" plus null terminator"
" exceeds 108 bytes\n", runtime_dir, name);
- close(s->fd);
free(s);
/* to prevent programs reporting
* "failed to add socket: Success" */
@@ -1342,6 +1335,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) {
+ free(s);
+ return -1;
+ }
+
wl_log("using socket %s\n", s->addr.sun_path);
s->fd_lock = get_socket_lock(s);
--
1.7.12.4
More information about the wayland-devel
mailing list