mirror of
https://github.com/systemd/systemd.git
synced 2024-11-08 02:57:16 +03:00
process-util: trivial optimization
This commit is contained in:
parent
03af6492f0
commit
a6149b93af
@ -181,10 +181,10 @@ int is_kernel_thread(pid_t pid) {
|
|||||||
bool eof;
|
bool eof;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
if (pid == 0)
|
if (pid == 0 || pid == 1) /* pid 1, and we ourselves certainly aren't a kernel thread */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
assert(pid > 0);
|
assert(pid > 1);
|
||||||
|
|
||||||
p = procfs_file_alloca(pid, "cmdline");
|
p = procfs_file_alloca(pid, "cmdline");
|
||||||
f = fopen(p, "re");
|
f = fopen(p, "re");
|
||||||
|
Loading…
Reference in New Issue
Block a user