summaryrefslogtreecommitdiffstats
path: root/ProcessList.c
diff options
context:
space:
mode:
Diffstat (limited to 'ProcessList.c')
-rw-r--r--ProcessList.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ProcessList.c b/ProcessList.c
index 30cd0f03..499f36a0 100644
--- a/ProcessList.c
+++ b/ProcessList.c
@@ -382,6 +382,11 @@ static void ProcessList_buildTree(ProcessList* this) {
if (process->pid == ppid)
r = 0;
+ // On Linux both the init process (pid 1) and the root UMH kernel thread (pid 2)
+ // use a ppid of 0. As that PID can't exist, we can skip searching for it.
+ if (!ppid)
+ r = 0;
+
while (l < r) {
int c = (l + r) / 2;
pid_t pid = ((Process*)Vector_get(this->processes, c))->pid;