]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
process-util: trivial optimization
authorLennart Poettering <lennart@poettering.net>
Fri, 28 Aug 2015 17:29:03 +0000 (19:29 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 31 Aug 2015 11:20:43 +0000 (13:20 +0200)
src/basic/process-util.c

index 61f188467f8a15e4afe439a6c34f523a065855cc..cff2d2a0348c091c0d33618f3c7a1561c71ea253 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");