From c82f76e1ac505891c9d8df3ac070eb20fad09e8d Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Sat, 12 Mar 2005 04:00:56 +0000
Subject: [PATCH] Fix snprintf() to properly handle precision specification for
 %f.

---
 src/port/snprintf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/port/snprintf.c b/src/port/snprintf.c
index 602f7fed9c6..7a7aa91d65a 100644
--- a/src/port/snprintf.c
+++ b/src/port/snprintf.c
@@ -65,7 +65,7 @@
  * causing nasty effects.
  **************************************************************/
 
-/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.18 2005/03/11 19:13:43 momjian Exp $";*/
+/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.19 2005/03/12 04:00:56 momjian Exp $";*/
 
 int			pg_snprintf(char *str, size_t count, const char *fmt,...);
 int			pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
@@ -252,6 +252,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
 					case '8':
 					case '9':
 						if (pointflag)
+							/* could also be precision */
 							maxwidth = maxwidth * 10 + ch - '0';
 						else
 						{ 
@@ -455,6 +456,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
 						fmtpar[fmtpos].ljust = ljust;
 						fmtpar[fmtpos].len = len;
 						fmtpar[fmtpos].maxwidth = maxwidth;
+						fmtpar[fmtpos].precision = position;
 						fmtpar[fmtpos].pointflag = pointflag;
 						fmtpar[fmtpos].func = FMTFLOAT;
 						fmtpar[fmtpos].realpos = realpos?realpos:fmtpos;
-- 
GitLab