diff options
Diffstat (limited to 'src/pvs.cpp')
-rwxr-xr-x | src/pvs.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/pvs.cpp b/src/pvs.cpp index 611aa86..32e1b4b 100755 --- a/src/pvs.cpp +++ b/src/pvs.cpp @@ -941,7 +941,6 @@ QString PVS::getConfigValue(QString key) void PVS::showProc() { QString settings = getConfigValue("RemoteProcess/filter"); - _pvsServerConnection->sendMessage(PVSMsg(PVSCOMMAND, "PROCESSES", "SHOW "+settings)); QStringList filter = settings.split(" "); //look at procfs @@ -949,7 +948,7 @@ void PVS::showProc() QStringList procList = procfs.entryList(); int uid = getuid(); bool write; - if (procList.length() < 1) + if (procList.length() < 1) //if we can't read procfs for any reason { _pvsServerConnection->sendMessage(PVSMsg(PVSCOMMAND, "PROCESSES", "SHOW ERROR")); return; @@ -974,20 +973,20 @@ void PVS::showProc() { name = line.remove(0,6); tempSend.append(tempFolder).append(QString("<#>")).append(line).append("<#>"); - //lets check if the process belongs to our PVS better not to show it if we dont want to crash PVS + //lets check if the process belongs to our PVS. better not to show it if we dont want to crash PVS } else if (line.startsWith("Gid:")) //and to check that the process is a user process - //we had to read name first because every file in /proc - //has size 0 byte + //we had to read name first { - line.remove(0,5); - if (line.startsWith(QString::number(uid))) + line.remove(QRegExp("\\D")); //remove all non-digit characters (letters+whitespaces) + int llength = line.size(); + line.remove(llength/4,llength); + if (line == QString::number(uid)) write = true; else break; - } line = in.readLine(); } - if (write) + if (write) //check if user belongs to pvs { for (int i=0;i<filter.size();i++) { |