1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-03 01:17:45 +03:00

Merge pull request #26324 from yuwata/argv-util-update-short-name

argv-util: also update short invocation name
This commit is contained in:
Yu Watanabe 2023-02-07 12:08:07 +09:00 committed by GitHub
commit 8586e8ab84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View File

@ -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

View File

@ -3,3 +3,4 @@ Description=Log filtering unit
[Service]
ExecStart=sh -c 'while true; do echo "Logging from the service, and ~more~"; sleep .25; done'
SyslogLevel=notice

View File

@ -199,7 +199,7 @@ function run_service_and_fetch_logs() {
journalctl --sync
END=$(date '+%Y-%m-%d %T.%6N')
journalctl -q -u "$UNIT" -S "$START" -U "$END" | grep -Pv "systemd\[[0-9]+\]"
journalctl -q -u "$UNIT" -S "$START" -U "$END" -p notice
systemctl stop "$UNIT"
}