From d9f68f48f75989b0992705d2fac8ff615671e6b9 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 24 Oct 2024 12:07:24 +0200 Subject: [PATCH] run: prefix unit description with our own process name I think we should try to communicate clearly if something is a run0 session, or a systemd-run invocation. Hence, let's initialize the description so that the command is prefixed by program_invocation_short_name. Effectively this means that our run0 sessions now appear as services with a description of "[run0] -/bin/bash" --- src/run/run.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/run/run.c b/src/run/run.c index 42eb756fa9c..d4eb148cf64 100644 --- a/src/run/run.c +++ b/src/run/run.c @@ -2435,7 +2435,7 @@ static int run(int argc, char* argv[]) { } if (!arg_description) { - char *t; + _cleanup_free_ char *t = NULL; if (strv_isempty(arg_cmdline)) t = strdup(arg_unit); @@ -2444,7 +2444,9 @@ static int run(int argc, char* argv[]) { if (!t) return log_oom(); - free_and_replace(arg_description, t); + arg_description = strjoin("[", program_invocation_short_name, "] ", t); + if (!arg_description) + return log_oom(); } /* For backward compatibility reasons env var expansion is disabled by default for scopes, and -- 2.47.3