[PATCH 1/5] server: Create socket path prior the socket

Kristian Høgsberg hoegsberg at gmail.com
Thu Feb 28 12:10:09 PST 2013


On Wed, Feb 27, 2013 at 12:10:16PM +0100, Benjamin Franzke wrote:
> This is just in preparation for systemd socket activation
> since we need to know the path before creating/acquiring the socket.

Hey Benjamin,

The patches look good and are fairly non-intrusive, but I'm not sure
when weston would be socket activated?

Kristian

> ---
>  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
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list