summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2003-03-14 04:48:09 +0000
committerdas <das@FreeBSD.org>2003-03-14 04:48:09 +0000
commit1859ac4c250644dc9d8024377dabece07d1995fa (patch)
treef0e2b49cb1890aad41f8d58d8b149e1297d21b82 /lib
parent4ffbd7a7a7a06dbfcb355e797b4abab22bb1a658 (diff)
downloadFreeBSD-src-1859ac4c250644dc9d8024377dabece07d1995fa.zip
FreeBSD-src-1859ac4c250644dc9d8024377dabece07d1995fa.tar.gz
Kludge around a bug that results from printf() assuming that
dtoa() is buggy. The bug would cause incorrect output to be generated when format strings such as '%5.0f' were used with nonzero numbers whose magnitude is less than 1. Reported by: df(1) by way of periodic(8) Reviewed by: mike
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdio/vfprintf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c
index 460d416..5ade7fe 100644
--- a/lib/libc/stdio/vfprintf.c
+++ b/lib/libc/stdio/vfprintf.c
@@ -1536,7 +1536,7 @@ cvt(double value, int ndigits, int flags, char *sign, int *decpt,
/* print trailing zeros */
bp = digits + ndigits;
if (ch == 'f') {
- if (*digits == '0' && value)
+ if ((*digits == '0' || *digits == '\0') && value)
*decpt = -ndigits + 1;
bp += *decpt;
}
OpenPOWER on IntegriCloud