Commit 50fb8bfb authored by Thiago Macieira's avatar Thiago Macieira
Browse files

Don't crash when the /proc/<pid>/stat file failed to open.

This may happen if a process exits after we got the /proc listing. If
we fail to open the file, readAll() returns empty, which means split()
returns an empty list, which means you can't do at(1).
parent bd660f9b
......@@ -197,7 +197,9 @@ static QList<ProcData> unixProcessList()
filename += procId;
filename += QLatin1String("/stat");
QFile file(filename);
file.open(QIODevice::ReadOnly);
if (!file.open(QIODevice::ReadOnly))
continue; // process may have exited
const QStringList data = QString::fromLocal8Bit(file.readAll()).split(' ');
ProcData proc;
proc.ppid = procId;
......
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