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).
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user