chiark / gitweb /
logind: always kill session when termination is requested
[elogind.git] / src / login / logind-user.c
index fdbf6e3aa08ef73df5e30a283932004e49e34b45..ac4a651f367323d8b876c2afb7c831dc35f9ba3c 100644 (file)
@@ -494,13 +494,13 @@ static int user_remove_runtime_path(User *u) {
         return r;
 }
 
-int user_stop(User *u) {
+int user_stop(User *u, bool force) {
         Session *s;
         int r = 0, k;
         assert(u);
 
         LIST_FOREACH(sessions_by_user, s, u->sessions) {
-                k = session_stop(s);
+                k = session_stop(s, force);
                 if (k < 0)
                         r = k;
         }
@@ -648,9 +648,12 @@ UserState user_get_state(User *u) {
                 bool all_closing = true;
 
                 LIST_FOREACH(sessions_by_user, i, u->sessions) {
-                        if (session_is_active(i))
+                        SessionState state;
+
+                        state = session_get_state(i);
+                        if (state == SESSION_ACTIVE)
                                 return USER_ACTIVE;
-                        if (session_get_state(i) != SESSION_CLOSING)
+                        if (state != SESSION_CLOSING)
                                 all_closing = false;
                 }