Merge pull request #15546 from poettering/pid1-serialize-comand-fix
core: make sure to restore the control command id, too
This commit is contained in:
commit
9786b27cbb
|
@ -2569,6 +2569,8 @@ static unsigned service_exec_command_index(Unit *u, ServiceExecCommand id, ExecC
|
|||
ExecCommand *first, *c;
|
||||
|
||||
assert(s);
|
||||
assert(id >= 0);
|
||||
assert(id < _SERVICE_EXEC_COMMAND_MAX);
|
||||
|
||||
first = s->exec_command[id];
|
||||
|
||||
|
@ -2632,10 +2634,12 @@ static int service_serialize_exec_command(Unit *u, FILE *f, ExecCommand *command
|
|||
|
||||
p = cescape(command->path);
|
||||
if (!p)
|
||||
return -ENOMEM;
|
||||
return log_oom();
|
||||
|
||||
key = strjoina(type, "-command");
|
||||
return serialize_item_format(f, key, "%s %u %s %s", service_exec_command_to_string(id), idx, p, args);
|
||||
(void) serialize_item_format(f, key, "%s %u %s %s", service_exec_command_to_string(id), idx, p, args);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
|
||||
|
@ -2737,7 +2741,11 @@ static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int service_deserialize_exec_command(Unit *u, const char *key, const char *value) {
|
||||
static int service_deserialize_exec_command(
|
||||
Unit *u,
|
||||
const char *key,
|
||||
const char *value) {
|
||||
|
||||
Service *s = SERVICE(u);
|
||||
int r;
|
||||
unsigned idx = 0, i;
|
||||
|
@ -2826,9 +2834,10 @@ static int service_deserialize_exec_command(Unit *u, const char *key, const char
|
|||
break;
|
||||
}
|
||||
|
||||
if (command && control)
|
||||
if (command && control) {
|
||||
s->control_command = command;
|
||||
else if (command)
|
||||
s->control_command_id = id;
|
||||
} else if (command)
|
||||
s->main_command = command;
|
||||
else
|
||||
log_unit_warning(u, "Current command vanished from the unit file, execution of the command list won't be resumed.");
|
||||
|
|
Loading…
Reference in New Issue