diff --git a/Process.h b/Process.h index 9bfe4d5d..04a118e5 100644 --- a/Process.h +++ b/Process.h @@ -111,6 +111,9 @@ typedef struct Process_ { /* The main process executable */ char *procExe; + /* Tells if the executable has been replaced in the filesystem since start */ + bool procExeDeleted; + /* CPU number last executed on */ int processor; diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c index f8b48b25..bc160186 100644 --- a/linux/LinuxProcess.c +++ b/linux/LinuxProcess.c @@ -441,14 +441,14 @@ void LinuxProcess_makeCommandStr(Process* this) { if (haveCommInExe) WRITE_HIGHLIGHT(exeBasenameOffset, exeBasenameLen, commAttr, CMDLINE_HIGHLIGHT_FLAG_COMM); WRITE_HIGHLIGHT(exeBasenameOffset, exeBasenameLen, baseAttr, CMDLINE_HIGHLIGHT_FLAG_BASENAME); - if (lp->procExeDeleted) + if (this->procExeDeleted) WRITE_HIGHLIGHT(exeBasenameOffset, exeBasenameLen, delAttr, CMDLINE_HIGHLIGHT_FLAG_DELETED); str = stpcpy(str, procExe); } else { if (haveCommInExe) WRITE_HIGHLIGHT(0, exeBasenameLen, commAttr, CMDLINE_HIGHLIGHT_FLAG_COMM); WRITE_HIGHLIGHT(0, exeBasenameLen, baseAttr, CMDLINE_HIGHLIGHT_FLAG_BASENAME); - if (lp->procExeDeleted) + if (this->procExeDeleted) WRITE_HIGHLIGHT(0, exeBasenameLen, delAttr, CMDLINE_HIGHLIGHT_FLAG_DELETED); str = stpcpy(str, procExe + exeBasenameOffset); } @@ -698,7 +698,7 @@ static void LinuxProcess_writeField(const Process* this, RichString* str, Proces const char* procExe; if (this->procExe) { attr = CRT_colors[Process_isUserlandThread(this) ? PROCESS_THREAD_BASENAME : PROCESS_BASENAME]; - if (lp->procExeDeleted) + if (this->procExeDeleted) attr = CRT_colors[FAILED_READ]; procExe = this->procExe + lp->procExeBasenameOffset; } else { diff --git a/linux/LinuxProcess.h b/linux/LinuxProcess.h index 9d5cfc4c..a39b8408 100644 --- a/linux/LinuxProcess.h +++ b/linux/LinuxProcess.h @@ -65,7 +65,6 @@ typedef struct LinuxProcess_ { Process super; int procExeLen; int procExeBasenameOffset; - bool procExeDeleted; int procCmdlineBasenameOffset; int procCmdlineBasenameEnd; LinuxProcessMergedCommand mergedCommand; diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c index a55bada7..dfe14dde 100644 --- a/linux/LinuxProcessList.c +++ b/linux/LinuxProcessList.c @@ -1178,9 +1178,9 @@ static bool LinuxProcessList_readCmdlineFile(Process* process, openat_arg_t proc const char* deletedMarker = " (deleted)"; if (strlen(process->procExe) > strlen(deletedMarker)) { - lp->procExeDeleted = String_eq(process->procExe + strlen(process->procExe) - strlen(deletedMarker), deletedMarker); + process->procExeDeleted = String_eq(process->procExe + strlen(process->procExe) - strlen(deletedMarker), deletedMarker); - if (lp->procExeDeleted && strlen(process->procExe) - strlen(deletedMarker) == 1 && process->procExe[0] == '/') { + if (process->procExeDeleted && strlen(process->procExe) - strlen(deletedMarker) == 1 && process->procExe[0] == '/') { lp->procExeBasenameOffset = 0; } } @@ -1190,7 +1190,7 @@ static bool LinuxProcessList_readCmdlineFile(Process* process, openat_arg_t proc process->procExe = NULL; lp->procExeLen = 0; lp->procExeBasenameOffset = 0; - lp->procExeDeleted = false; + process->procExeDeleted = false; lp->mergedCommand.exeChanged = true; }