summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qlockfile_unix.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2021-04-23 14:54:38 -0700
committerThiago Macieira <thiago.macieira@intel.com>2021-04-26 04:42:32 +0000
commitc58be606dd6df5634a4cd4835033c64bc9d112fe (patch)
tree638fc8b1a46e829e2fc0d2c002812eeecec721d4 /src/corelib/io/qlockfile_unix.cpp
parent615972b74fffd7ed6b9d8c8b29b347f73749c6a9 (diff)
QLockFile/Unix: remove the " (deleted)" suffix from kernel-supplied names
The kernel appends that to the symlink targets in /proc for files that have been deleted. Change-Id: I7a386ad4f0cb4e2ba629fffd16789b5a52491627 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'src/corelib/io/qlockfile_unix.cpp')
-rw-r--r--src/corelib/io/qlockfile_unix.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp
index b531140437..fb728144a4 100644
--- a/src/corelib/io/qlockfile_unix.cpp
+++ b/src/corelib/io/qlockfile_unix.cpp
@@ -238,6 +238,12 @@ QString QLockFilePrivate::processNameByPid(qint64 pid)
// The pid is gone. Return some invalid process name to fail the test.
return QStringLiteral("/ERROR/");
}
+
+ // remove the " (deleted)" suffix, if any
+ static const char deleted[] = " (deleted)";
+ if (buf.endsWith(deleted))
+ buf.chop(strlen(deleted));
+
return QFileInfo(QFile::decodeName(buf)).fileName();
#elif defined(Q_OS_HAIKU)
thread_info info;