From 754c0d6bb98e8dbe412ad149717e26e07c57c5e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Fri, 24 Sep 2021 20:53:34 +0200 Subject: Linux: always compute procExeDeleted if already set A process, whose executable has been replaced and thus marked by htop, can be re-executed with the replaced executable, with the same PID, in two ways: the Linux feature checkpoint/restore or re-execution of PID 1. The actual check is just a string comparison, like the dropped condition, leading to (almost) no computation overhead. --- linux/LinuxProcessList.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c index 0baf0bb0..38c5d3e0 100644 --- a/linux/LinuxProcessList.c +++ b/linux/LinuxProcessList.c @@ -1236,8 +1236,8 @@ static bool LinuxProcessList_readCmdlineFile(Process* process, openat_arg_t proc if (amtRead > 0) { filename[amtRead] = 0; if (!process->procExe || - (!process->procExeDeleted && !String_eq(filename, process->procExe)) || - (process->procExeDeleted && !String_startsWith(filename, process->procExe))) { + (!process->procExeDeleted && !String_eq(filename, process->procExe)) || + process->procExeDeleted) { const char* deletedMarker = " (deleted)"; const size_t markerLen = strlen(deletedMarker); -- cgit v1.2.3