summaryrefslogtreecommitdiff
path: root/src/port
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2018-10-08 19:15:55 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2018-10-08 19:15:55 -0400
commit7767aadd94cd252a12fa00f6122ad4dd10455791 (patch)
tree45e9ef585c1a9023ddb78995b76782b4d61e282d /src/port
parent82ff0cc91d9840d1c56ca1beed58bedfde3da9a3 (diff)
downloadpostgresql-7767aadd94cd252a12fa00f6122ad4dd10455791.tar.gz
Fix omissions in snprintf.c's coverage of standard *printf functions.
A warning on a NetBSD box revealed to me that pg_waldump/compat.c is using vprintf(), which snprintf.c did not provide coverage for. This is not good if we want to have uniform *printf behavior, and it's pretty silly to omit when it's a one-line function. I also noted that snprintf.c has pg_vsprintf() but for some reason it was not exposed to the outside world, creating another way in which code might accidentally invoke the platform *printf family. Let's just make sure that we replace all eight of the POSIX-standard printf family. Also, upgrade plperl.h and plpython.h to make sure that they do their undefine/redefine rain dance for all eight, not some random maybe-sufficient subset thereof.
Diffstat (limited to 'src/port')
-rw-r--r--src/port/snprintf.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/port/snprintf.c b/src/port/snprintf.c
index 58300eab95..31438dded4 100644
--- a/src/port/snprintf.c
+++ b/src/port/snprintf.c
@@ -102,9 +102,11 @@
/* Prevent recursion */
#undef vsnprintf
#undef snprintf
+#undef vsprintf
#undef sprintf
#undef vfprintf
#undef fprintf
+#undef vprintf
#undef printf
/*
@@ -208,7 +210,7 @@ pg_snprintf(char *str, size_t count, const char *fmt,...)
return len;
}
-static int
+int
pg_vsprintf(char *str, const char *fmt, va_list args)
{
PrintfTarget target;
@@ -271,6 +273,12 @@ pg_fprintf(FILE *stream, const char *fmt,...)
}
int
+pg_vprintf(const char *fmt, va_list args)
+{
+ return pg_vfprintf(stdout, fmt, args);
+}
+
+int
pg_printf(const char *fmt,...)
{
int len;