Fix %c for floating values that become 0 when coerced to int.

Obtained from: OpenBSD run.c 1.36 (From Jeremy Devenport)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D12379
This commit is contained in:
Warner Losh 2017-09-24 05:04:02 +00:00
parent 547f34cace
commit 8e537f8ae0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=323964

View File

@ -918,7 +918,7 @@ int format(char **pbuf, int *pbufsize, const char *s, Node *a) /* printf-like co
break;
case 'c':
if (isnum(x)) {
if (getfval(x))
if ((int)getfval(x))
sprintf(p, fmt, (int) getfval(x));
else {
*p++ = '\0'; /* explicit null byte */