Skip to content

Commit

Permalink
Fix code style and make other minor changes
Browse files Browse the repository at this point in the history
Co-authored-by: BenBE <[email protected]>
  • Loading branch information
2 people authored and cgzones committed Aug 29, 2022
1 parent a52f6d4 commit 7b83459
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions linux/LinuxProcessList.c
Original file line number Diff line number Diff line change
Expand Up @@ -779,15 +779,15 @@ static bool LinuxProcessList_checkPidNamespace(Process *process, openat_arg_t pr

char *ptr = buffer;
int pid_ns_count = 0;
while(*ptr != '\0' && *ptr != '\n' && !isdigit(*ptr))
while (*ptr && *ptr != '\n' && !isdigit(*ptr))
++ptr;

while(*ptr != '\0' && *ptr != '\n') {
while (*ptr && *ptr != '\n') {
if (isdigit(*ptr))
pid_ns_count++;
while(isdigit(*ptr))
while (isdigit(*ptr))
++ptr;
while(*ptr != '\0' && *ptr != '\n' && !isdigit(*ptr))
while (*ptr && *ptr != '\n' && !isdigit(*ptr))
++ptr;
}

Expand Down Expand Up @@ -1550,11 +1550,12 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, openat_arg_

LinuxProcessList_recurseProcTree(this, procFd, "task", proc, period);

if ((ss->flags & PROCESS_FLAG_LINUX_CGROUP) || hideRunningInContainer) {
if (ss->flags & PROCESS_FLAG_LINUX_CGROUP || hideRunningInContainer) {
LinuxProcessList_readCGroupFile(lp, procFd);
if (hideRunningInContainer && lp->cgroup && isContainerOrVMSlice(lp -> cgroup)) {
if (!LinuxProcessList_checkPidNamespace(proc, procFd))
if (hideRunningInContainer && lp->cgroup && isContainerOrVMSlice(lp->cgroup)) {
if (!LinuxProcessList_checkPidNamespace(proc, procFd)) {
goto errorReadingProcess;
}
}
}

Expand Down Expand Up @@ -1636,7 +1637,7 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, openat_arg_
char statCommand[MAX_NAME + 1];
unsigned long long int lasttimes = (lp->utime + lp->stime);
unsigned long int tty_nr = proc->tty_nr;
if (! LinuxProcessList_readStatFile(proc, procFd, statCommand, sizeof(statCommand)))
if (!LinuxProcessList_readStatFile(proc, procFd, statCommand, sizeof(statCommand)))
goto errorReadingProcess;

if (lp->flags & PF_KTHREAD) {
Expand Down

0 comments on commit 7b83459

Please sign in to comment.