diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c index 4564f8e6..f5a35193 100644 --- a/linux/LinuxProcessList.c +++ b/linux/LinuxProcessList.c @@ -1292,11 +1292,16 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, openat_arg_ } // filename is a number: process directory - int pid = atoi(name); - - if (pid <= 0) - continue; + int pid; + { + char* endptr; + unsigned long parsedPid = strtoul(name, &endptr, 10); + if (parsedPid == 0 || parsedPid == ULONG_MAX || *endptr != '\0') + continue; + pid = parsedPid; + } + // Skip task directory of main thread if (parent && pid == parent->pid) continue;