dcavalca / rpms / systemd

Forked from rpms/systemd 4 months ago
Clone
Blob Blame History Raw
From bd9127d97ae66b547a6e3a89a70b5045d706b68c Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Wed, 2 Apr 2014 14:41:26 +0200
Subject: [PATCH] logind-session: save stopping flag

---
 src/login/logind-session.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index ece222a..0fa290b 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -187,12 +187,14 @@ int session_save(Session *s) {
                 "USER=%s\n"
                 "ACTIVE=%i\n"
                 "STATE=%s\n"
-                "REMOTE=%i\n",
+                "REMOTE=%i\n"
+                "STOPPING=%i\n",
                 (unsigned long) s->user->uid,
                 s->user->name,
                 session_is_active(s),
                 session_state_to_string(session_get_state(s)),
-                s->remote);
+                s->remote,
+                s->stopping);
 
         if (s->type >= 0)
                 fprintf(f, "TYPE=%s\n", session_type_to_string(s->type));
@@ -267,7 +269,8 @@ int session_load(Session *s) {
                 *class = NULL,
                 *uid = NULL,
                 *realtime = NULL,
-                *monotonic = NULL;
+                *monotonic = NULL,
+                *stopping = NULL;
 
         int k, r;
 
@@ -291,6 +294,7 @@ int session_load(Session *s) {
                            "UID",            &uid,
                            "REALTIME",       &realtime,
                            "MONOTONIC",      &monotonic,
+                           "STOPPING",       &stopping,
                            NULL);
 
         if (r < 0) {
@@ -391,6 +395,11 @@ int session_load(Session *s) {
                         s->timestamp.monotonic = l;
         }
 
+        if (stopping) {
+                k = parse_boolean(stopping);
+                if (k >= 0)
+                        s->stopping = k;
+        }
         return r;
 }