]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/service: correct comment in service_deserialize_exec_command() 37362/head
authorMike Yuan <me@yhndnzj.com>
Wed, 9 Apr 2025 13:22:37 +0000 (15:22 +0200)
committerMike Yuan <me@yhndnzj.com>
Tue, 6 May 2025 14:13:16 +0000 (16:13 +0200)
The index of ExecCommand is serialized, not PID.

src/core/service.c

index a3e50788dfcaf81c3aa10144801791e6acb5631b..141c85745a19e0667515c49468f55ebcca647430 100644 (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();
                 }