daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
803fb7
From 932ae09a155ef463d99d4b4e7cf04aafbcd78a19 Mon Sep 17 00:00:00 2001
803fb7
From: Lukas Nykryn <lnykryn@redhat.com>
803fb7
Date: Wed, 2 Apr 2014 14:41:26 +0200
803fb7
Subject: [PATCH] logind-session: save stopping flag
803fb7
803fb7
Conflicts:
803fb7
	src/login/logind-session.c
803fb7
---
803fb7
 src/login/logind-session.c | 17 +++++++++++++----
803fb7
 1 file changed, 13 insertions(+), 4 deletions(-)
803fb7
803fb7
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
803fb7
index a02a537f7..d2e7b4012 100644
803fb7
--- a/src/login/logind-session.c
803fb7
+++ b/src/login/logind-session.c
803fb7
@@ -181,12 +181,14 @@ int session_save(Session *s) {
803fb7
                 "USER=%s\n"
803fb7
                 "ACTIVE=%i\n"
803fb7
                 "STATE=%s\n"
803fb7
-                "REMOTE=%i\n",
803fb7
-                s->user->uid,
803fb7
+                "REMOTE=%i\n"
803fb7
+                "STOPPING=%i\n",
803fb7
+                (unsigned long) s->user->uid,
803fb7
                 s->user->name,
803fb7
                 session_is_active(s),
803fb7
                 session_state_to_string(session_get_state(s)),
803fb7
-                s->remote);
803fb7
+                s->remote,
803fb7
+                s->stopping);
803fb7
 
803fb7
         if (s->type >= 0)
803fb7
                 fprintf(f, "TYPE=%s\n", session_type_to_string(s->type));
803fb7
@@ -309,7 +311,8 @@ int session_load(Session *s) {
803fb7
                 *uid = NULL,
803fb7
                 *realtime = NULL,
803fb7
                 *monotonic = NULL,
803fb7
-                *controller = NULL;
803fb7
+                *controller = NULL,
803fb7
+                *stopping = NULL;
803fb7
 
803fb7
         int k, r;
803fb7
 
803fb7
@@ -337,6 +340,7 @@ int session_load(Session *s) {
803fb7
                            "REALTIME",       &realtime,
803fb7
                            "MONOTONIC",      &monotonic,
803fb7
                            "CONTROLLER",     &controller,
803fb7
+                           "STOPPING",       &stopping,
803fb7
                            NULL);
803fb7
 
803fb7
         if (r < 0)
803fb7
@@ -453,6 +457,11 @@ int session_load(Session *s) {
803fb7
                         session_restore_vt(s);
803fb7
         }
803fb7
 
803fb7
+        if (stopping) {
803fb7
+                k = parse_boolean(stopping);
803fb7
+                if (k >= 0)
803fb7
+                        s->stopping = k;
803fb7
+        }
803fb7
         return r;
803fb7
 }
803fb7