login: ignore JobRemoved of old jobs
authorDavid Herrmann <dh.herrmann@gmail.com>
Mon, 16 Nov 2015 14:45:02 +0000 (15:45 +0100)
committerDavid Herrmann <dh.herrmann@gmail.com>
Mon, 16 Nov 2015 15:15:42 +0000 (16:15 +0100)
If we requeue jobs, we are no longer interested in old jobs. Hence, we
better ignore any JobRemoved signals for old jobs and concentrate on our
replacements.

src/login/logind-dbus.c

index e36217c..e507a19 100644 (file)
@@ -2620,11 +2620,8 @@ int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *err
         }
 
         session = hashmap_get(m->session_units, unit);
-        if (session) {
-
-                if (streq_ptr(path, session->scope_job))
-                        session->scope_job = mfree(session->scope_job);
-
+        if (session && streq_ptr(path, session->scope_job)) {
+                session->scope_job = mfree(session->scope_job);
                 session_jobs_reply(session, unit, result);
 
                 session_save(session);
@@ -2633,7 +2630,9 @@ int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *err
         }
 
         user = hashmap_get(m->user_units, unit);
-        if (user) {
+        if (user &&
+            (streq_ptr(path, user->service_job) ||
+             streq_ptr(path, user->slice_job))) {
 
                 if (streq_ptr(path, user->service_job))
                         user->service_job = mfree(user->service_job);