utils/serviceutils: compare executablePath against canonical path of exec fields in .desktops

/proc/%/exec always points to the canonical/real path of a binary,
the exec field of a .desktop might contain a symlink and therefore
differ from canonical path.
Explicitely canonicalizing the path in exec prevents this mismatch.
This commit is contained in:
John Zimmermann 2022-02-14 15:50:22 +01:00
parent 8e05732670
commit 9c65d61b98

View file

@ -32,7 +32,7 @@ static QStringList fetchProcessServiceField(const QString &executablePath, const
static QLoggingCategory KWIN_UTILS ("KWIN_UTILS", QtWarningMsg); static QLoggingCategory KWIN_UTILS ("KWIN_UTILS", QtWarningMsg);
const auto servicesFound = KApplicationTrader::query([&executablePath] (const KService::Ptr &service) { const auto servicesFound = KApplicationTrader::query([&executablePath] (const KService::Ptr &service) {
if (service->exec().isEmpty() || service->exec() != executablePath) if (service->exec().isEmpty() || QFileInfo(service->exec()).canonicalFilePath() != executablePath)
return false; return false;
return true; return true;