dryang / rpms / systemd

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