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
3 changed files with 6 additions and 1 deletions
+4
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
@@ -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
+1 -1
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"
}