systemd/0014-logind-update-state-file-after-generating-the-sessio.patch

82 lines
3.2 KiB
Diff
Raw Normal View History

From 49d2e4a62d9c94c4c4aeeb6c4da4b226f9a638a7 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 26 Jul 2013 17:32:19 +0200
Subject: [PATCH] logind: update state file after generating the session fifo,
not before
https://bugs.freedesktop.org/show_bug.cgi?id=67273
---
src/login/logind-dbus.c | 7 ++++++-
src/login/logind-session-dbus.c | 4 ++++
src/machine/machined-dbus.c | 3 ++-
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 39af637..b5e975a 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -643,6 +643,10 @@ static int bus_manager_create_session(Manager *m, DBusMessage *message) {
session->create_message = dbus_message_ref(message);
+ /* Now, let's wait until the slice unit and stuff got
+ * created. We send the reply back from
+ * session_send_create_reply().*/
+
return 0;
fail:
@@ -2356,7 +2360,6 @@ DBusHandlerResult bus_message_filter(
if (streq_ptr(path, s->scope_job)) {
free(s->scope_job);
s->scope_job = NULL;
- session_save(s);
if (s->started) {
if (streq(result, "done"))
@@ -2366,6 +2369,8 @@ DBusHandlerResult bus_message_filter(
session_send_create_reply(s, &error);
}
}
+
+ session_save(s);
}
session_add_to_gc_queue(s);
diff --git a/src/login/logind-session-dbus.c b/src/login/logind-session-dbus.c
index 62b9ffd..210f756 100644
--- a/src/login/logind-session-dbus.c
+++ b/src/login/logind-session-dbus.c
@@ -535,6 +535,10 @@ int session_send_create_reply(Session *s, DBusError *error) {
if (!s->create_message)
return 0;
+ /* This is called after the session scope was successfully
+ * created, and finishes where bus_manager_create_session()
+ * left off. */
+
if (error) {
DBusError buffer;
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c
index 1e8bc60..6c4d50b 100644
--- a/src/machine/machined-dbus.c
+++ b/src/machine/machined-dbus.c
@@ -543,7 +543,6 @@ DBusHandlerResult bus_message_filter(
if (streq_ptr(path, mm->scope_job)) {
free(mm->scope_job);
mm->scope_job = NULL;
- machine_save(mm);
if (mm->started) {
if (streq(result, "done"))
@@ -553,6 +552,8 @@ DBusHandlerResult bus_message_filter(
machine_send_create_reply(mm, &error);
}
}
+
+ machine_save(mm);
}
machine_add_to_gc_queue(mm);