pidref: we never have to verify PID 1

The process exists as long as the kernel/userns exists at all, hence we
don't have to verify a pidfd to it.
This commit is contained in:
Lennart Poettering
2023-10-18 14:39:33 +02:00
parent f2a2e60be6
commit 3d7ba61a7b
+3
View File
@@ -250,6 +250,9 @@ int pidref_verify(const PidRef *pidref) {
if (!pidref_is_set(pidref))
return -ESRCH;
if (pidref->pid == 1)
return 1; /* PID 1 can never go away, hence never be recycled to a different process → return 1 */
if (pidref->fd < 0)
return 0; /* If we don't have a pidfd we cannot validate it, hence we assume it's all OK → return 0 */