diff options
author | Colin Percival <cperciva@FreeBSD.org> | 2021-10-17 20:36:38 +0000 |
---|---|---|
committer | Colin Percival <cperciva@FreeBSD.org> | 2021-10-17 20:36:38 +0000 |
commit | 52e125c2bd302982c179ecc920cc9a6e166033d6 (patch) | |
tree | 55fda8d70e4884eb23acc9e301b6d30f9cf68625 /sys/kern | |
parent | 0d6516b453469ce1d92ec903c4c4df9ee08be0f9 (diff) | |
download | src-52e125c2bd302982c179ecc920cc9a6e166033d6.tar.gz src-52e125c2bd302982c179ecc920cc9a6e166033d6.zip |
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
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_tslog.c | 5 |
1 files 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; } |