Commit ac072e4c authored by hjk's avatar hjk

devicesupport: use /proc/exe to retrieve a full path

Change-Id: I8bb91b72a5a2a3547eced9a99cceebd9952bc21a
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@digia.com>
parent e3c6506e
......@@ -176,11 +176,16 @@ static QList<DeviceProcess> getLocalProcessesUsingProc(const QDir &procDir)
DeviceProcess proc;
proc.pid = procId.toInt();
const QString root = procDirPath + procId;
QFile exeFile(root + QLatin1String("/exe"));
proc.exe = exeFile.symLinkTarget();
QFile cmdLineFile(root + QLatin1String("/cmdline"));
if (cmdLineFile.open(QIODevice::ReadOnly)) { // process may have exited
QList<QByteArray> tokens = cmdLineFile.readAll().split('\0');
if (!tokens.isEmpty()) {
proc.exe = QString::fromLocal8Bit(tokens.front());
if (proc.exe.isEmpty())
proc.exe = QString::fromLocal8Bit(tokens.front());
foreach (const QByteArray &t, tokens) {
if (!proc.cmdLine.isEmpty())
proc.cmdLine.append(QLatin1Char(' '));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment