From: Lennart Poettering Date: Thu, 24 Oct 2024 10:07:24 +0000 (+0200) Subject: run: prefix unit description with our own process name X-Git-Tag: v257-rc1~139^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d9f68f48f75989b0992705d2fac8ff615671e6b9;p=thirdparty%2Fsystemd.git 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" --- 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