git: 52e125c2bd30 - main - TSLOG: Report final execname, not first
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 17 Oct 2021 20:42:31 UTC
The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=52e125c2bd302982c179ecc920cc9a6e166033d6 commit 52e125c2bd302982c179ecc920cc9a6e166033d6 Author: Colin Percival <cperciva@FreeBSD.org> AuthorDate: 2021-10-17 20:36:38 +0000 Commit: Colin Percival <cperciva@FreeBSD.org> CommitDate: 2021-10-17 20:36:38 +0000 TSLOG: Report final execname, not first In cases such as daemons launched via limits(1), a process may call exec multiple times; the last name of the last binary executed is usually (always?) more informative. Fixes: 46dd801acb23 Add userland boot profiling to TSLOG Sponsored by: https://www.patreon.com/cperciva --- sys/kern/kern_tslog.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_tslog.c b/sys/kern/kern_tslog.c index 38c91911ec08..0e7ad3c9ff23 100644 --- a/sys/kern/kern_tslog.c +++ b/sys/kern/kern_tslog.c @@ -169,8 +169,9 @@ tslog_user(pid_t pid, pid_t ppid, const char * execname, const char * namei) /* If we have an execname, record it. */ if (execname != NULL) { - if (procs[pid].execname == NULL) - procs[pid].execname = strdup(execname, M_TSLOGUSER); + if (procs[pid].execname != NULL) + free(procs[pid].execname, M_TSLOGUSER); + procs[pid].execname = strdup(execname, M_TSLOGUSER); return; }