summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgad <gad@FreeBSD.org>2006-03-08 09:15:20 +0000
committergad <gad@FreeBSD.org>2006-03-08 09:15:20 +0000
commit59d0573b934949404abbe2c4473920f8910c8708 (patch)
treee8789379256521276a1ee3dfdef7fe4404f36538
parentec3e08db90b8033da09c5f11061c1546308e2c3b (diff)
downloadFreeBSD-src-59d0573b934949404abbe2c4473920f8910c8708.zip
FreeBSD-src-59d0573b934949404abbe2c4473920f8910c8708.tar.gz
Collapse strncpy/strncat/strncat into a single snprintf, as suggested
by pjd. MFC after: 3 weeks
-rw-r--r--bin/ps/keyword.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c
index a80b8ed3..9ae82c3 100644
--- a/bin/ps/keyword.c
+++ b/bin/ps/keyword.c
@@ -314,9 +314,7 @@ findvar(char *p, int user, char **header)
*/
rflen = strlen(v->alias) + strlen(hp) + 2;
realfmt = malloc(rflen);
- strlcpy(realfmt, v->alias, rflen);
- strlcat(realfmt, "=", rflen);
- strlcat(realfmt, hp, rflen);
+ snprintf(realfmt, rflen, "%s=%s", v->alias, hp);
parsefmt(realfmt, user);
return ((VAR *)NULL);
}
OpenPOWER on IntegriCloud