Linux: fix process parsing for hidden pid directories

This commit is contained in:
Christian Göttsche 2020-11-29 12:46:25 +01:00
parent 5ee6875f73
commit 9549ca8c88
1 changed files with 2 additions and 2 deletions

View File

@ -1330,12 +1330,12 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, openat_arg_
proc->tgid = parent ? parent->pid : pid; proc->tgid = parent ? parent->pid : pid;
#ifdef HAVE_OPENAT #ifdef HAVE_OPENAT
int procFd = openat(dirFd, name, O_PATH | O_DIRECTORY | O_NOFOLLOW); int procFd = openat(dirFd, entry->d_name, O_PATH | O_DIRECTORY | O_NOFOLLOW);
if (procFd < 0) if (procFd < 0)
goto errorReadingProcess; goto errorReadingProcess;
#else #else
char procFd[4096]; char procFd[4096];
xSnprintf(procFd, sizeof(procFd), "%s/%s", dirFd, name); xSnprintf(procFd, sizeof(procFd), "%s/%s", dirFd, entry->d_name);
#endif #endif
LinuxProcessList_recurseProcTree(this, procFd, "task", proc, period, now); LinuxProcessList_recurseProcTree(this, procFd, "task", proc, period, now);