diff options
author | Sylvia Else <sylviabz1@cryogenic.net> | 2013-10-06 23:06:35 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-10-07 23:41:05 -0400 |
commit | 6aca9a587d4ad40b1c044f99e3714022201b9fd4 (patch) | |
tree | 5dba694bf7853e1329c0a00593e55c447a27d255 /src/core | |
parent | 2b8f6883a17b9386299b7690869ccd8e20fe0347 (diff) |
systemd: serialize/deserialize forbid_restart value
The Service type's forbid_restart field was not preserved by
serialization/deserialization, so the fact that the service should not
be restarted after stopping was lost.
If a systemctl stop foo command has been given, but the foo service
has not yet stopped, and then the systemctl --system daemon-reload was
given, then when the foo service eventually stopped, systemd would
restart it.
https://bugs.freedesktop.org/show_bug.cgi?id=69800
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/service.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/service.c b/src/core/service.c index 67920248d3..98b1599a32 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -2651,6 +2651,9 @@ static int service_serialize(Unit *u, FILE *f, FDSet *fds) { if (s->exec_context.var_tmp_dir) unit_serialize_item(u, f, "var-tmp-dir", s->exec_context.var_tmp_dir); + if (s->forbid_restart) + unit_serialize_item(u, f, "forbid_restart", yes_no(s->forbid_restart)); + return 0; } @@ -2787,6 +2790,14 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value, return log_oom(); s->exec_context.var_tmp_dir = t; + } else if (streq(key, "forbid_restart")) { + int b; + + b = parse_boolean(value); + if (b < 0) + log_debug_unit(u->id, "Failed to parse forbid_restart value %s", value); + else + s->forbid_restart = b; } else log_debug_unit(u->id, "Unknown serialization key '%s'", key); |