core/service: correct comment in service_deserialize_exec_command()

The index of ExecCommand is serialized, not PID.
This commit is contained in:
Mike Yuan
2025-04-09 15:22:37 +02:00
parent 729228e7da
commit e1fa0e1a2f

View File

@@ -3190,7 +3190,7 @@ int service_deserialize_exec_command(
bool control, found = false, last = false;
int r;
enum ExecCommandState {
enum {
STATE_EXEC_COMMAND_TYPE,
STATE_EXEC_COMMAND_INDEX,
STATE_EXEC_COMMAND_PATH,
@@ -3216,6 +3216,7 @@ int service_deserialize_exec_command(
break;
switch (state) {
case STATE_EXEC_COMMAND_TYPE:
id = service_exec_command_from_string(arg);
if (id < 0)
@@ -3223,11 +3224,12 @@ int service_deserialize_exec_command(
state = STATE_EXEC_COMMAND_INDEX;
break;
case STATE_EXEC_COMMAND_INDEX:
/* PID 1234 is serialized as either '1234' or '+1234'. The second form is used to
* mark the last command in a sequence. We warn if the deserialized command doesn't
* match what we have loaded from the unit, but we don't need to warn if that is the
* last command. */
/* ExecCommand index 1234 is serialized as either '1234' or '+1234'. The second form
* is used to mark the last command in a sequence. We warn if the deserialized command
* doesn't match what we have loaded from the unit, but we don't need to warn if
* that is the last command. */
r = safe_atou(arg, &idx);
if (r < 0)
@@ -3236,15 +3238,18 @@ int service_deserialize_exec_command(
state = STATE_EXEC_COMMAND_PATH;
break;
case STATE_EXEC_COMMAND_PATH:
path = TAKE_PTR(arg);
state = STATE_EXEC_COMMAND_ARGS;
break;
case STATE_EXEC_COMMAND_ARGS:
r = strv_extend(&argv, arg);
if (r < 0)
return r;
break;
default:
assert_not_reached();
}