valeriyvdovin / rpms / systemd

Forked from rpms/systemd 4 years ago
Clone

Blame SOURCES/0018-systemd-serialize-deserialize-forbid_restart-value.patch

572a44
From d5a7089608ccde2302b185ec367165c8b5623a12 Mon Sep 17 00:00:00 2001
a4b143
From: Sylvia Else <sylviabz1@cryogenic.net>
a4b143
Date: Sun, 6 Oct 2013 23:06:35 -0400
a4b143
Subject: [PATCH] systemd: serialize/deserialize forbid_restart value
a4b143
a4b143
The Service type's forbid_restart field was not preserved by
a4b143
serialization/deserialization, so the fact that the service should not
a4b143
be restarted after stopping was lost.
a4b143
a4b143
If a systemctl stop foo command has been given, but the foo service
a4b143
has not yet stopped, and then the systemctl --system daemon-reload was
a4b143
given, then when the foo service eventually stopped, systemd would
a4b143
restart it.
a4b143
a4b143
https://bugs.freedesktop.org/show_bug.cgi?id=69800
a4b143
---
a4b143
 src/core/service.c | 11 +++++++++++
a4b143
 1 file changed, 11 insertions(+)
a4b143
a4b143
diff --git a/src/core/service.c b/src/core/service.c
572a44
index 6792024..98b1599 100644
a4b143
--- a/src/core/service.c
a4b143
+++ b/src/core/service.c
572a44
@@ -2651,6 +2651,9 @@ static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
a4b143
         if (s->exec_context.var_tmp_dir)
a4b143
                 unit_serialize_item(u, f, "var-tmp-dir", s->exec_context.var_tmp_dir);
a4b143
 
a4b143
+        if (s->forbid_restart)
a4b143
+                unit_serialize_item(u, f, "forbid_restart", yes_no(s->forbid_restart));
a4b143
+
a4b143
         return 0;
a4b143
 }
a4b143
 
572a44
@@ -2787,6 +2790,14 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
a4b143
                         return log_oom();
a4b143
 
a4b143
                 s->exec_context.var_tmp_dir = t;
a4b143
+        } else if (streq(key, "forbid_restart")) {
a4b143
+                int b;
a4b143
+
a4b143
+                b = parse_boolean(value);
a4b143
+                if (b < 0)
a4b143
+                        log_debug_unit(u->id, "Failed to parse forbid_restart value %s", value);
a4b143
+                else
a4b143
+                        s->forbid_restart = b;
a4b143
         } else
a4b143
                 log_debug_unit(u->id, "Unknown serialization key '%s'", key);
a4b143