From: Mike Yuan Date: Wed, 9 Apr 2025 13:22:37 +0000 (+0200) Subject: core/service: correct comment in service_deserialize_exec_command() X-Git-Tag: v258-rc1~678^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F37362%2Fhead;p=thirdparty%2Fsystemd.git core/service: correct comment in service_deserialize_exec_command() The index of ExecCommand is serialized, not PID. --- diff --git a/src/core/service.c b/src/core/service.c index a3e50788dfc..141c85745a1 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -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(); }