[PATCH weston] xwayland: Remove pointless newline in X11 lock

Eric Engestrom eric at engestrom.ch
Wed Nov 16 21:59:41 UTC 2016


On Wednesday, 2016-11-16 16:37:59 +0000, Daniel Stone wrote:
> The newline was always chopped off by snprintf: pid is only 11

Don't you mean 10?
Reviewed-by: Eric Engestrom <eric at engestrom.ch>

> characters long, and we were asking to print 11 characters plus the
> terminating NULL. Hence snprintf would always chop the newline anyway.
> 
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> Cc: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> ---
>  xwayland/launcher.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/xwayland/launcher.c b/xwayland/launcher.c
> index 97d7c6e..31599d6 100644
> --- a/xwayland/launcher.c
> +++ b/xwayland/launcher.c
> @@ -201,7 +201,7 @@ create_lockfile(int display, char *lockfile, size_t lsize)
>  
>  	/* Subtle detail: we use the pid of the wayland
>  	 * compositor, not the xserver in the lock file. */
> -	size = snprintf(pid, sizeof pid, "%10d\n", getpid());
> +	size = snprintf(pid, sizeof pid, "%10d", getpid());
>  	if (write(fd, pid, size) != size) {
>  		unlink(lockfile);
>  		close(fd);
> -- 
> 2.9.3
> 


More information about the wayland-devel mailing list