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

Daniel Stone daniels at collabora.com
Wed Nov 16 16:37:59 UTC 2016


The newline was always chopped off by snprintf: pid is only 11
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