summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-08-06 19:02:29 +0200
committerSven Eden <sven.eden@prydeworx.com>2018-10-29 10:18:34 +0100
commit4cb7603a2558061ef4c7d9c693f1c5e1d64e0d5a (patch)
treec68e1741b34eba38890202d9ea05fca8164e28b4
parentd1f2956082e945c96fb74ec19a3302763d209325 (diff)
logind: never elect a session that is stopping as display
(cherry picked from commit 04857cd801022d9f9933efb484c6253572f09870)
-rw-r--r--src/login/logind-user.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index 12b8bf63e..91611e88e 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -680,11 +680,10 @@ int user_kill(User *u, int signo) {
}
static bool elect_display_filter(Session *s) {
- /* Return true if the session is a candidate for the user’s ‘primary
- * session’ or ‘display’. */
+ /* Return true if the session is a candidate for the user’s ‘primary session’ or ‘display’. */
assert(s);
- return (s->class == SESSION_USER && !s->stopping);
+ return s->class == SESSION_USER && s->started && !s->stopping;
}
static int elect_display_compare(Session *s1, Session *s2) {
@@ -730,9 +729,8 @@ void user_elect_display(User *u) {
assert(u);
- /* This elects a primary session for each user, which we call
- * the "display". We try to keep the assignment stable, but we
- * "upgrade" to better choices. */
+ /* This elects a primary session for each user, which we call the "display". We try to keep the assignment
+ * stable, but we "upgrade" to better choices. */
log_debug("Electing new display for user %s", u->name);
LIST_FOREACH(sessions_by_user, s, u->sessions) {