Include comm before cmdline if exe could not be read, but comm mismatches basename from cmdline

Also highlights entries where exe was marked deleted
This commit is contained in:
Benny Baumann
2020-11-23 22:55:56 +01:00
committed by BenBE
parent ec36c5ccf8
commit 21e3063e2e
3 changed files with 35 additions and 2 deletions

View File

@ -1051,12 +1051,22 @@ static bool LinuxProcessList_readCmdlineFile(Process* process, const char* dirna
;
lp->procExeBasenameOffset = amtRead + 1;
lp->mergedCommand.exeChanged = true;
const char* deletedMarker = " (deleted)";
if (strlen(lp->procExe) > strlen(deletedMarker)) {
lp->procExeDeleted = String_eq(lp->procExe + strlen(lp->procExe) - strlen(deletedMarker), deletedMarker);
if (lp->procExeDeleted && strlen(lp->procExe) - strlen(deletedMarker) == 1 && lp->procExe[0] == '/') {
lp->procExeBasenameOffset = 0;
}
}
}
} else if (lp->procExe) {
free(lp->procExe);
lp->procExe = NULL;
lp->procExeLen = 0;
lp->procExeBasenameOffset = 0;
lp->procExeDeleted = false;
lp->mergedCommand.exeChanged = true;
}