From: Yu Watanabe Date: Fri, 3 Feb 2023 09:29:36 +0000 (+0900) Subject: argv-util: also update program_invocation_short_name X-Git-Tag: v253-rc3~36^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F26324%2Fhead;p=thirdparty%2Fsystemd.git argv-util: also update program_invocation_short_name Our logging uses program_invocation_short_name. Without this patch, logs from forked client may become broken; spuriously truncated or the short invocation name is not completely shown in the log. --- diff --git a/src/basic/argv-util.c b/src/basic/argv-util.c index b8c371ede5b..6c88dcc2ee9 100644 --- a/src/basic/argv-util.c +++ b/src/basic/argv-util.c @@ -192,6 +192,10 @@ int rename_process(const char name[]) { strncpy(program_invocation_name, name, k); if (l > k) truncated = true; + + /* Also update the short name. */ + char *p = strrchr(program_invocation_name, '/'); + program_invocation_short_name = p ? p + 1 : program_invocation_name; } /* Third step, completely replace the argv[] array the kernel maintains for us. This requires privileges, but