diff options
author | Yuri Pankov <yuripv@FreeBSD.org> | 2020-06-07 08:21:19 +0000 |
---|---|---|
committer | Yuri Pankov <yuripv@FreeBSD.org> | 2020-06-07 08:21:19 +0000 |
commit | aa8ab146972cd47a56598f800caebc121f166325 (patch) | |
tree | 2f18b07e8eb24421dd54c2f7d80e6ae10483b0b6 /bin/ps/ps.c | |
parent | 857e0646caf18a5ee37b53f2d9e7520c7df1aac7 (diff) | |
download | src-aa8ab146972cd47a56598f800caebc121f166325.tar.gz src-aa8ab146972cd47a56598f800caebc121f166325.zip |
ps: use %hs instead of %s format specifiers
Use %hs (locale-based encoding) instead of %s (UTF-8) format for
strings that are expected to be in current locale encoding (date/time,
process names/argument list).
PR: 241491
Reviewed by: phil
Differential Revision: https://reviews.freebsd.org/D22160
Notes
Notes:
svn path=/head/; revision=361887
Diffstat (limited to 'bin/ps/ps.c')
-rw-r--r-- | bin/ps/ps.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c index 305247609510..8b865bc4a091 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -192,6 +192,7 @@ main(int argc, char *argv[]) char fmtbuf[_POSIX2_LINE_MAX]; (void) setlocale(LC_ALL, ""); + xo_no_setlocale(); time(&now); /* Used by routines in print.c. */ /* @@ -696,7 +697,7 @@ main(int argc, char *argv[]) fwidthmin = (xo_get_style(NULL) != XO_STYLE_TEXT || (STAILQ_NEXT(vent, next_ve) == NULL && (vent->var->flag & LJUST))) ? 0 : vent->var->width; - snprintf(fmtbuf, sizeof(fmtbuf), "{:%s/%%%s%d..%ds}", + snprintf(fmtbuf, sizeof(fmtbuf), "{:%s/%%%s%d..%dhs}", vent->var->field ? vent->var->field : vent->var->name, (vent->var->flag & LJUST) ? "-" : "", fwidthmin, fwidthmax); |