summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/login/logind.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/login/logind.c b/src/login/logind.c
index 702382acff..8bf520a2db 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -993,9 +993,11 @@ int manager_get_session_by_pid(Manager *m, pid_t pid, Session **session) {
int r;
assert(m);
- assert(pid >= 1);
assert(session);
+ if (pid < 1)
+ return -EINVAL;
+
r = cg_pid_get_unit(pid, &unit);
if (r < 0)
return r;
@@ -1014,9 +1016,11 @@ int manager_get_user_by_pid(Manager *m, pid_t pid, User **user) {
int r;
assert(m);
- assert(pid >= 1);
assert(user);
+ if (pid < 1)
+ return -EINVAL;
+
r = cg_pid_get_slice(pid, &unit);
if (r < 0)
return r;