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:
parent
547f34cace
commit
8e537f8ae0
@ -918,7 +918,7 @@ int format(char **pbuf, int *pbufsize, const char *s, Node *a) /* printf-like co
|
|||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
if (isnum(x)) {
|
if (isnum(x)) {
|
||||||
if (getfval(x))
|
if ((int)getfval(x))
|
||||||
sprintf(p, fmt, (int) getfval(x));
|
sprintf(p, fmt, (int) getfval(x));
|
||||||
else {
|
else {
|
||||||
*p++ = '\0'; /* explicit null byte */
|
*p++ = '\0'; /* explicit null byte */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user