summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-09-24 20:53:34 +0200
committerBenBE <BenBE@geshi.org>2021-09-24 22:03:16 +0200
commit754c0d6bb98e8dbe412ad149717e26e07c57c5e7 (patch)
tree07d5b2c2f49dc8f7082bc29313c4d0548a90931a
parent9f4a4faab9d599b95fcb17b81a08f086f32f05a9 (diff)
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.
-rw-r--r--linux/LinuxProcessList.c4
1 files 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);

© 2014-2024 Faster IT GmbH | imprint | privacy policy