From 6f876815c6e8a06f07e27b7658e04d6d595d9584 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Tue, 3 Oct 2017 12:26:02 +0100 Subject: [PATCH] logind: use pid_is_valid() where appropriate These two sites _do_ match the definition of pid_is_valid(); they don't provide any special handling for the invalid PID value 0. (They're used by dbus methods, so the PID value 0 is handled with reference to the dbus client creds, outside of these functions). --- src/login/logind-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/login/logind-core.c b/src/login/logind-core.c index 997c421e9a8..ba538559f9e 100644 --- a/src/login/logind-core.c +++ b/src/login/logind-core.c @@ -287,7 +287,7 @@ int manager_get_session_by_pid(Manager *m, pid_t pid, Session **session) { assert(m); - if (pid < 1) + if (!pid_is_valid(pid)) return -EINVAL; r = cg_pid_get_unit(pid, &unit); @@ -311,7 +311,7 @@ int manager_get_user_by_pid(Manager *m, pid_t pid, User **user) { assert(m); assert(user); - if (pid < 1) + if (!pid_is_valid(pid)) return -EINVAL; r = cg_pid_get_slice(pid, &unit); -- 2.47.3