[systemd-devel] [PATCH 7/7] logind: do not call session_jobs_reply() on CLOSING

Djalal Harouni tixxdz at opendz.org
Thu Feb 6 12:37:20 PST 2014


match_job_removed() signal is triggered when queued jobs finish during
session opening or closing.

Calling session_jobs_reply() during opening is valid, but during
session closing does not make sense.

The session_send_create_reply() function which is called by
session_jobs_reply() is able to detect if it was not called during
open time by checking the 'session->create_message'. However, making
session_jobs_reply() check session_is_opening() and user_is_opening()
is more comprehensive.
---
 src/login/logind-dbus.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 24482fd..4b71d9e 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -1930,6 +1930,10 @@ static int session_jobs_reply(Session *s, const char *unit, const char *result,
         if (!s->started)
                 return r;
 
+        /* Don't call me if this is not opening state */
+        if (!session_is_opening(s) && !user_is_opening(s->user))
+                return r;
+
         if (streq(result, "done"))
                 r = session_send_create_reply(s, NULL, opening);
         else {
@@ -2010,6 +2014,7 @@ int match_job_removed(sd_bus *bus, sd_bus_message *message, void *userdata, sd_b
                          * still being created this will be set to true,
                          * otherwise it will be false */
                         active = service_job || !!session->scope_job;
+
                         session_jobs_reply(session, unit, result, active);
                 }
 
-- 
1.8.3.1



More information about the systemd-devel mailing list