ryantimwilson / rpms / systemd

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