mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
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. (cherry picked from commitdd15e4cb57
) (cherry picked from commitce4726468d
)
This commit is contained in:
parent
9a620ef11d
commit
7a862d9d1a
@ -368,6 +368,10 @@ int rename_process(const char name[]) {
|
|||||||
strncpy(program_invocation_name, name, k);
|
strncpy(program_invocation_name, name, k);
|
||||||
if (l > k)
|
if (l > k)
|
||||||
truncated = true;
|
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
|
/* Third step, completely replace the argv[] array the kernel maintains for us. This requires privileges, but
|
||||||
|
Loading…
Reference in New Issue
Block a user