From f3446acbcdbbee9811bbcd5ca97698d04080453a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 24 Apr 2021 20:24:36 -0700 Subject: [PATCH] QCoreApplication::applicationDirPath/Linux: use /proc/self There's no need to format our PID there if /proc/self exists and is a link to the current process. Drive-by replace with QStringLiteral, since we won't do any formatting anyway. Change-Id: I7a386ad4f0cb4e2ba629fffd1678fbf0a484ea69 Reviewed-by: Oswald Buddenhagen --- src/corelib/kernel/qcoreapplication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 5f25b1c025..bf397c14da 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2336,7 +2336,7 @@ QString QCoreApplication::applicationFilePath() # if defined(Q_OS_LINUX) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_EMBEDDED)) // Try looking for a /proc//exe symlink first which points to // the absolute path of the executable - QFileInfo pfi(QString::fromLatin1("/proc/%1/exe").arg(getpid())); + QFileInfo pfi(QStringLiteral("/proc/self/exe")); if (pfi.exists() && pfi.isSymLink()) { QCoreApplicationPrivate::setApplicationFilePath(pfi.canonicalFilePath()); return *QCoreApplicationPrivate::cachedApplicationFilePath;