]> granicus.if.org Git - postgresql/commitdiff
protect vfprintf from hijacking by Windows gettext just like other members of the...
authorAndrew Dunstan <andrew@dunslane.net>
Tue, 28 Nov 2006 01:12:34 +0000 (01:12 +0000)
committerAndrew Dunstan <andrew@dunslane.net>
Tue, 28 Nov 2006 01:12:34 +0000 (01:12 +0000)
src/include/port.h
src/port/snprintf.c

index 21c8b92643282292c0c490b062e5459721a70596..59a15c103ca5c04e9a50b1c1c2fd8ceb82f7dd22 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/port.h,v 1.105 2006/10/19 20:56:22 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/port.h,v 1.106 2006/11/28 01:12:33 adunstan Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -145,6 +145,9 @@ extern unsigned char pg_tolower(unsigned char ch);
 #ifdef sprintf
 #undef sprintf
 #endif
+#ifdef vfprintf
+#undef vfprintf
+#endif
 #ifdef fprintf
 #undef fprintf
 #endif
@@ -161,6 +164,7 @@ extern int
 pg_sprintf(char *str, const char *fmt,...)
 /* This extension allows gcc to check the format string */
 __attribute__((format(printf, 2, 3)));
+extern int     pg_vfprintf(FILE * stream, const char *fmt, va_list args);
 extern int
 pg_fprintf(FILE *stream, const char *fmt,...)
 /* This extension allows gcc to check the format string */
@@ -179,12 +183,14 @@ __attribute__((format(printf, 1, 2)));
 #define vsnprintf(...) pg_vsnprintf(__VA_ARGS__)
 #define snprintf(...)  pg_snprintf(__VA_ARGS__)
 #define sprintf(...)   pg_sprintf(__VA_ARGS__)
+#define vfprintf(...)  pg_vfprintf(__VA_ARGS__)
 #define fprintf(...)   pg_fprintf(__VA_ARGS__)
 #define printf(...)            pg_printf(__VA_ARGS__)
 #else
 #define vsnprintf              pg_vsnprintf
 #define snprintf               pg_snprintf
 #define sprintf                        pg_sprintf
+#define vfprintf               pg_vfprintf
 #define fprintf                        pg_fprintf
 #define printf                 pg_printf
 #endif
index e4472e5bdb47ad91558e88ea0e4d4924a2a65518..d588ac3bc5fd44e2ca3940568837e6b03ff9f647 100644 (file)
@@ -31,7 +31,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $PostgreSQL: pgsql/src/port/snprintf.c,v 1.32 2006/10/04 00:30:14 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/snprintf.c,v 1.33 2006/11/28 01:12:34 adunstan Exp $
  */
 
 #include "c.h"
@@ -99,6 +99,7 @@
 #undef vsnprintf
 #undef snprintf
 #undef sprintf
+#undef vfprintf
 #undef fprintf
 #undef printf
 
@@ -209,7 +210,7 @@ pg_sprintf(char *str, const char *fmt,...)
        return len;
 }
 
-static int
+int
 pg_vfprintf(FILE *stream, const char *fmt, va_list args)
 {
        PrintfTarget target;