richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
572a44
From bd9127d97ae66b547a6e3a89a70b5045d706b68c Mon Sep 17 00:00:00 2001
572a44
From: Lukas Nykryn <lnykryn@redhat.com>
572a44
Date: Wed, 2 Apr 2014 14:41:26 +0200
572a44
Subject: [PATCH] logind-session: save stopping flag
572a44
572a44
---
572a44
 src/login/logind-session.c | 15 ++++++++++++---
572a44
 1 file changed, 12 insertions(+), 3 deletions(-)
572a44
572a44
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
572a44
index ece222a..0fa290b 100644
572a44
--- a/src/login/logind-session.c
572a44
+++ b/src/login/logind-session.c
572a44
@@ -187,12 +187,14 @@ int session_save(Session *s) {
572a44
                 "USER=%s\n"
572a44
                 "ACTIVE=%i\n"
572a44
                 "STATE=%s\n"
572a44
-                "REMOTE=%i\n",
572a44
+                "REMOTE=%i\n"
572a44
+                "STOPPING=%i\n",
572a44
                 (unsigned long) s->user->uid,
572a44
                 s->user->name,
572a44
                 session_is_active(s),
572a44
                 session_state_to_string(session_get_state(s)),
572a44
-                s->remote);
572a44
+                s->remote,
572a44
+                s->stopping);
572a44
 
572a44
         if (s->type >= 0)
572a44
                 fprintf(f, "TYPE=%s\n", session_type_to_string(s->type));
572a44
@@ -267,7 +269,8 @@ int session_load(Session *s) {
572a44
                 *class = NULL,
572a44
                 *uid = NULL,
572a44
                 *realtime = NULL,
572a44
-                *monotonic = NULL;
572a44
+                *monotonic = NULL,
572a44
+                *stopping = NULL;
572a44
 
572a44
         int k, r;
572a44
 
572a44
@@ -291,6 +294,7 @@ int session_load(Session *s) {
572a44
                            "UID",            &uid,
572a44
                            "REALTIME",       &realtime,
572a44
                            "MONOTONIC",      &monotonic,
572a44
+                           "STOPPING",       &stopping,
572a44
                            NULL);
572a44
 
572a44
         if (r < 0) {
572a44
@@ -391,6 +395,11 @@ int session_load(Session *s) {
572a44
                         s->timestamp.monotonic = l;
572a44
         }
572a44
 
572a44
+        if (stopping) {
572a44
+                k = parse_boolean(stopping);
572a44
+                if (k >= 0)
572a44
+                        s->stopping = k;
572a44
+        }
572a44
         return r;
572a44
 }
572a44