1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 09:56:51 +03:00

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
This commit is contained in:
Sylvia Else 2013-10-06 23:06:35 -04:00 committed by Zbigniew Jędrzejewski-Szmek
parent 2b8f6883a1
commit 6aca9a587d
Notes: Lennart Poettering 2013-10-09 04:30:03 +02:00
Backport: bugfix

View File

@ -2651,6 +2651,9 @@ static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
if (s->exec_context.var_tmp_dir) if (s->exec_context.var_tmp_dir)
unit_serialize_item(u, f, "var-tmp-dir", 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; return 0;
} }
@ -2787,6 +2790,14 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
return log_oom(); return log_oom();
s->exec_context.var_tmp_dir = t; 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 } else
log_debug_unit(u->id, "Unknown serialization key '%s'", key); log_debug_unit(u->id, "Unknown serialization key '%s'", key);