svn commit: r363816 - stable/12/bin/ps
Mark Johnston
markj at FreeBSD.org
Tue Aug 4 00:28:06 UTC 2020
Author: markj
Date: Tue Aug 4 00:28:06 2020
New Revision: 363816
URL: https://svnweb.freebsd.org/changeset/base/363816
Log:
MFC r363649:
ps(1): Fix formatting of the "command" field for kernel threads.
Modified:
stable/12/bin/ps/ps.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/bin/ps/ps.c
==============================================================================
--- stable/12/bin/ps/ps.c Mon Aug 3 23:06:33 2020 (r363815)
+++ stable/12/bin/ps/ps.c Tue Aug 4 00:28:06 2020 (r363816)
@@ -1264,6 +1264,7 @@ fmt(char **(*fn)(kvm_t *, const struct kinfo_proc *, i
static void
saveuser(KINFO *ki)
{
+ char tdname[COMMLEN + 1];
char *argsp;
if (ki->ki_p->ki_flag & P_INMEM) {
@@ -1280,12 +1281,14 @@ saveuser(KINFO *ki)
* save arguments if needed
*/
if (needcomm) {
- if (ki->ki_p->ki_stat == SZOMB)
+ if (ki->ki_p->ki_stat == SZOMB) {
ki->ki_args = strdup("<defunct>");
- else if (UREADOK(ki) || (ki->ki_p->ki_args != NULL))
+ } else if (UREADOK(ki) || (ki->ki_p->ki_args != NULL)) {
+ (void)snprintf(tdname, sizeof(tdname), "%s%s",
+ ki->ki_p->ki_tdname, ki->ki_p->ki_moretdname);
ki->ki_args = fmt(kvm_getargv, ki,
- ki->ki_p->ki_comm, ki->ki_p->ki_tdname, MAXCOMLEN);
- else {
+ ki->ki_p->ki_comm, tdname, COMMLEN * 2 + 1);
+ } else {
asprintf(&argsp, "(%s)", ki->ki_p->ki_comm);
ki->ki_args = argsp;
}
More information about the svn-src-all
mailing list