summaryrefslogtreecommitdiff
path: root/src/login/logind-core.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2015-07-07 19:38:41 +0200
committerSven Eden <yamakuzure@gmx.net>2017-03-14 10:06:00 +0100
commit6c36148bbc47bead5483bb4e911f6698c1e7c21e (patch)
tree0770da346a6b953615e02e192f1456bbf5a6c0e1 /src/login/logind-core.c
parentbad23a8de0f2bc88e8efa180395f2051132c8fe8 (diff)
logind: fail on CreateSession if already in session
Right now, if you're already in a session and call CreateSession, we return information about the current session of yours. This is highy confusing and a nasty hack. Avoid that, and instead return a commonly known error, so the caller can detect that. This has the side-effect, that we no longer override XDG_VTNR and XDG_SEAT in pam_systemd, if you're already in a session. But this sounds like the right thing to do, anyway.
Diffstat (limited to 'src/login/logind-core.c')
-rw-r--r--src/login/logind-core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/login/logind-core.c b/src/login/logind-core.c
index e1e288f0f..59f5f8cc0 100644
--- a/src/login/logind-core.c
+++ b/src/login/logind-core.c
@@ -317,7 +317,6 @@ int manager_get_session_by_pid(Manager *m, pid_t pid, Session **session) {
int r;
assert(m);
- assert(session);
if (pid < 1)
return -EINVAL;
@@ -330,7 +329,8 @@ int manager_get_session_by_pid(Manager *m, pid_t pid, Session **session) {
if (!s)
return 0;
- *session = s;
+ if (session)
+ *session = s;
return 1;
}