]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/exec-invoke: rename process earlier
authorMike Yuan <me@yhndnzj.com>
Thu, 30 Oct 2025 15:01:17 +0000 (16:01 +0100)
committerMike Yuan <me@yhndnzj.com>
Thu, 30 Oct 2025 16:45:34 +0000 (17:45 +0100)
This is independent of any other setup stages, and should
happen as early as possible to make comm logged by journald
accurate.

src/core/exec-invoke.c

index cb778359fc18953a035ae791c11d7e725b0d60af..c5d88dfd8260592d1375cd3664535d253d6d5601 100644 (file)
@@ -5053,6 +5053,8 @@ int exec_invoke(
                 return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid command line arguments.");
         }
 
+        rename_process_from_path(command->path);
+
         if (context->std_input == EXEC_INPUT_SOCKET ||
             context->std_output == EXEC_OUTPUT_SOCKET ||
             context->std_error == EXEC_OUTPUT_SOCKET) {
@@ -5078,8 +5080,6 @@ int exec_invoke(
                 return log_error_errno(r, "Failed to load a named file descriptor: %m");
         }
 
-        rename_process_from_path(command->path);
-
         /* We reset exactly these signals, since they are the only ones we set to SIG_IGN in the main
          * daemon. All others we leave untouched because we set them to SIG_DFL or a valid handler initially,
          * both of which will be demoted to SIG_DFL. */