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 <[email protected]>
Cc: Pekka Paalanen <[email protected]>
---
 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

_______________________________________________
wayland-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to