diff options
author | David Schultz <das@FreeBSD.org> | 2003-03-14 04:48:09 +0000 |
---|---|---|
committer | David Schultz <das@FreeBSD.org> | 2003-03-14 04:48:09 +0000 |
commit | 3ba6b6dd9dcba1668e44f5a0bc4212f1cbf3a696 (patch) | |
tree | f0e2b49cb1890aad41f8d58d8b149e1297d21b82 /lib | |
parent | 15a66d27983b7c66af8610073af27c15a79aa7e2 (diff) | |
download | src-3ba6b6dd9dcba1668e44f5a0bc4212f1cbf3a696.tar.gz src-3ba6b6dd9dcba1668e44f5a0bc4212f1cbf3a696.zip |
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
Notes
Notes:
svn path=/head/; revision=112224
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/stdio/vfprintf.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c index 460d4163b55a..5ade7fe5c9a2 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; } |