anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone
Blob Blame History Raw
From 932ae09a155ef463d99d4b4e7cf04aafbcd78a19 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

Conflicts:
	src/login/logind-session.c
---
 src/login/logind-session.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index a02a537..d2e7b40 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -181,12 +181,14 @@ int session_save(Session *s) {
                 "USER=%s\n"
                 "ACTIVE=%i\n"
                 "STATE=%s\n"
-                "REMOTE=%i\n",
-                s->user->uid,
+                "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));
@@ -309,7 +311,8 @@ int session_load(Session *s) {
                 *uid = NULL,
                 *realtime = NULL,
                 *monotonic = NULL,
-                *controller = NULL;
+                *controller = NULL,
+                *stopping = NULL;
 
         int k, r;
 
@@ -337,6 +340,7 @@ int session_load(Session *s) {
                            "REALTIME",       &realtime,
                            "MONOTONIC",      &monotonic,
                            "CONTROLLER",     &controller,
+                           "STOPPING",       &stopping,
                            NULL);
 
         if (r < 0)
@@ -453,6 +457,11 @@ int session_load(Session *s) {
                         session_restore_vt(s);
         }
 
+        if (stopping) {
+                k = parse_boolean(stopping);
+                if (k >= 0)
+                        s->stopping = k;
+        }
         return r;
 }