xwayland: pad pid with leading zeroes in lockfile

fixes #10652
This commit is contained in:
vaxerski 2025-06-04 16:54:12 +02:00
parent b5c0d0b8aa
commit d9f7448d82

View file

@ -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;
}