ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
Zbigniew Jędrzejewski-Szmek 62fe94
From f49650cee2c5256dc0491432e1f12a4ae19be6c5 Mon Sep 17 00:00:00 2001
Zbigniew Jędrzejewski-Szmek 62fe94
From: Lennart Poettering <lennart@poettering.net>
Zbigniew Jędrzejewski-Szmek 62fe94
Date: Thu, 21 Aug 2014 16:20:17 +0200
Zbigniew Jędrzejewski-Szmek 62fe94
Subject: [PATCH] service: don't invoke functions at the same time as declaring
Zbigniew Jędrzejewski-Szmek 62fe94
 variables
Zbigniew Jędrzejewski-Szmek 62fe94
Zbigniew Jędrzejewski-Szmek 62fe94
---
Zbigniew Jędrzejewski-Szmek 62fe94
 src/core/service.c | 8 ++++++--
Zbigniew Jędrzejewski-Szmek 62fe94
 1 file changed, 6 insertions(+), 2 deletions(-)
Zbigniew Jędrzejewski-Szmek 62fe94
Zbigniew Jędrzejewski-Szmek 62fe94
diff --git a/src/core/service.c b/src/core/service.c
Zbigniew Jędrzejewski-Szmek 62fe94
index f10582d89e..fc952e848f 100644
Zbigniew Jędrzejewski-Szmek 62fe94
--- a/src/core/service.c
Zbigniew Jędrzejewski-Szmek 62fe94
+++ b/src/core/service.c
Zbigniew Jędrzejewski-Szmek 62fe94
@@ -694,9 +694,13 @@ static void service_set_state(Service *s, ServiceState state) {
Zbigniew Jędrzejewski-Szmek 62fe94
         /* For remain_after_exit services, let's see if we can "release" the
Zbigniew Jędrzejewski-Szmek 62fe94
          * hold on the console, since unit_notify() only does that in case of
Zbigniew Jędrzejewski-Szmek 62fe94
          * change of state */
Zbigniew Jędrzejewski-Szmek 62fe94
-        if (state == SERVICE_EXITED && s->remain_after_exit &&
Zbigniew Jędrzejewski-Szmek 62fe94
+        if (state == SERVICE_EXITED &&
Zbigniew Jędrzejewski-Szmek 62fe94
+            s->remain_after_exit &&
Zbigniew Jędrzejewski-Szmek 62fe94
             UNIT(s)->manager->n_on_console > 0) {
Zbigniew Jędrzejewski-Szmek 62fe94
-                ExecContext *ec = unit_get_exec_context(UNIT(s));
Zbigniew Jędrzejewski-Szmek 62fe94
+
Zbigniew Jędrzejewski-Szmek 62fe94
+                ExecContext *ec;
Zbigniew Jędrzejewski-Szmek 62fe94
+
Zbigniew Jędrzejewski-Szmek 62fe94
+                ec = unit_get_exec_context(UNIT(s));
Zbigniew Jędrzejewski-Szmek 62fe94
                 if (ec && exec_context_may_touch_console(ec)) {
Zbigniew Jędrzejewski-Szmek 62fe94
                         Manager *m = UNIT(s)->manager;
Zbigniew Jędrzejewski-Szmek 62fe94