If vstr printf functions are #defined, undef them before redefinition
authorMartin Willi <martin@revosec.ch>
Fri, 10 Aug 2012 14:50:59 +0000 (16:50 +0200)
committerMartin Willi <martin@revosec.ch>
Fri, 10 Aug 2012 15:02:05 +0000 (17:02 +0200)
At least Mountain Lion seems to have them #defined to secure _chk
variants.

src/libstrongswan/printf_hook.h

index 93026cc..6beb4fe 100644 (file)
@@ -97,6 +97,37 @@ int vstr_wrapper_vsprintf(char *str, const char *format, va_list ap);
 int vstr_wrapper_vsnprintf(char *str, size_t size, const char *format, va_list ap);
 int vstr_wrapper_vasprintf(char **str, const char *format, va_list ap);
 
+#ifdef printf
+#undef printf
+#endif
+#ifdef fprintf
+#undef fprintf
+#endif
+#ifdef sprintf
+#undef sprintf
+#endif
+#ifdef snprintf
+#undef snprintf
+#endif
+#ifdef asprintf
+#undef asprintf
+#endif
+#ifdef vprintf
+#undef vprintf
+#endif
+#ifdef vfprintf
+#undef vfprintf
+#endif
+#ifdef vsprintf
+#undef vsprintf
+#endif
+#ifdef vsnprintf
+#undef vsnprintf
+#endif
+#ifdef vasprintf
+#undef vasprintf
+#endif
+
 #define printf vstr_wrapper_printf
 #define fprintf vstr_wrapper_fprintf
 #define sprintf vstr_wrapper_sprintf