chiark / gitweb /
Fix assertion failure when resuming from sleep/suspend
[elogind.git] / src / basic / process-util.c
index 07469871704e586700a3894b5392053d0f85b5b9..25044dfaa7bc916bb4768307c082d1fa337d691f 100644 (file)
@@ -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;