summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2008-03-18 01:49:44 +0000
committerTom Lane2008-03-18 01:49:44 +0000
commit56905ac29cf5d3b609f507a2fdc80b8f49c6a5f9 (patch)
tree00f54a092c168bebb0a74b663824a99db52c64ab
parentc0eccade38691d7b7721fe0bd0c7575bde388b2e (diff)
Fix our printf implementation to follow spec: if a star parameter
value for a precision is negative, act as though precision weren't specified at all, that is the whole .* part of the format spec should be ignored. Our previous coding took it as .0 which is certainly wrong. Per report from Kris Jurka and local testing. Possibly this should be back-patched, but it would be good to get some more testing first; in any case there are no known cases where there's really a problem on the backend side.
-rw-r--r--src/port/snprintf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/port/snprintf.c b/src/port/snprintf.c
index e6323e6937..66f3d5df86 100644
--- a/src/port/snprintf.c
+++ b/src/port/snprintf.c
@@ -565,7 +565,10 @@ nextch2:
{
precision = starval;
if (precision < 0)
+ {
precision = 0;
+ pointflag = 0;
+ }
}
else
{
@@ -590,7 +593,10 @@ nextch2:
{
precision = starval;
if (precision < 0)
+ {
precision = 0;
+ pointflag = 0;
+ }
}
else
{