From 0fbc0f42b5c45916f0dc713d9336808b629edb64 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Thu, 26 Sep 2019 12:05:28 +0900 Subject: [PATCH] Prevent use of backend string functions From PostgreSQL 12, port.h forcibly redefines printf() et al to use the versions defined by PostgreSQL (pg_printf() et al). As this causes linking issues in build environments which build pre-Pg12 versions against Pg12's libpq, ensure relevant macros defined in port.h are undefined. --- repmgr.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/repmgr.h b/repmgr.h index 23f3ec17..53e7874b 100644 --- a/repmgr.h +++ b/repmgr.h @@ -21,6 +21,37 @@ #include #endif +#ifdef vsnprintf +#undef vsnprintf +#endif +#ifdef snprintf +#undef snprintf +#endif +#ifdef vsprintf +#undef vsprintf +#endif +#ifdef sprintf +#undef sprintf +#endif +#ifdef vfprintf +#undef vfprintf +#endif +#ifdef fprintf +#undef fprintf +#endif +#ifdef vprintf +#undef vprintf +#endif +#ifdef printf +#undef printf +#endif +#ifdef strerror +#undef strerror +#endif +#ifdef strerror_r +#undef strerror_r +#endif + #ifndef _REPMGR_H_ #define _REPMGR_H_