mirror of
https://github.com/systemd/systemd.git
synced 2026-07-10 00:27:35 +00:00
logind: return -EINVAL when PID is wrong
dbus-send --print-reply --system --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.GetUserByPID uint32:0 causes systemd-logind[29843]: Assertion 'pid >= 1' failed at src/login/logind.c:938, function manager_get_user_by_pid(). Aborting.
This commit is contained in:
Notes:
Lennart Poettering
2013-10-04 17:11:46 +02:00
Backport: bugfix
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user