From d9f7448d82132f4c1c07105f4bc3a4f717915d30 Mon Sep 17 00:00:00 2001 From: vaxerski Date: Wed, 4 Jun 2025 16:54:12 +0200 Subject: [PATCH] xwayland: pad pid with leading zeroes in lockfile fixes #10652 --- src/xwayland/Server.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/xwayland/Server.cpp b/src/xwayland/Server.cpp index 814bd20c..0cc16fef 100644 --- a/src/xwayland/Server.cpp +++ b/src/xwayland/Server.cpp @@ -199,8 +199,9 @@ bool CXWaylandServer::tryOpenSockets() { continue; } - const std::string pidStr = std::to_string(getpid()); - if (write(fd.get(), pidStr.c_str(), pidStr.length()) != (long)pidStr.length()) { + const std::string pidStr = std::format("{:010d}\n", getpid()); + ASSERT(pidStr.length() == 11); + if (write(fd.get(), pidStr.c_str(), 11) != 11L) { safeRemove(lockPath); continue; }