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