X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fbasic%2Fprocess-util.c;h=8a1f54db81b61fd6949401cb81b389e4b9942b54;hb=5382831207810d62db22b6c87f35f73ddfb30b23;hp=07469871704e586700a3894b5392053d0f85b5b9;hpb=21ecddbbb2c9e06d080b2526a870898a8b90f52a;p=elogind.git diff --git a/src/basic/process-util.c b/src/basic/process-util.c index 074698717..8a1f54db8 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -181,10 +181,10 @@ int is_kernel_thread(pid_t pid) { bool eof; FILE *f; - if (pid == 0) + if (pid == 0 || pid == 1) /* pid 1, and we ourselves certainly aren't a kernel thread */ return 0; - assert(pid > 0); + assert(pid > 1); p = procfs_file_alloca(pid, "cmdline"); f = fopen(p, "re"); @@ -217,7 +217,7 @@ int get_process_capeff(pid_t pid, char **capeff) { p = procfs_file_alloca(pid, "status"); - r = get_status_field(p, "\nCapEff:", capeff); + r = get_proc_field(p, "CapEff", WHITESPACE, capeff); if (r == -ENOENT) return -ESRCH; @@ -368,7 +368,6 @@ int get_process_environ(pid_t pid, char **env) { return 0; } -#endif // 0 int get_parent_of_pid(pid_t pid, pid_t *_ppid) { int r; @@ -414,6 +413,7 @@ int get_parent_of_pid(pid_t pid, pid_t *_ppid) { return 0; } +#endif // 0 int wait_for_terminate(pid_t pid, siginfo_t *status) { siginfo_t dummy;