From 4f28eec947d9901605592def35de617134fa053f Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 27 Mar 2023 11:27:59 +0200 Subject: [PATCH] src: more tolerant snprintf() local override (#881) `#undef snprintf` before redefining it, when `HAVE_SNPRINTF` is not defined, even though `snprintf` is available and it should have been. Possibly with 3rd party builds. Downside is that cases of missing `HAVE_SNPRINTF` are less trivially detected at compile-time. --- src/libssh2_priv.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libssh2_priv.h b/src/libssh2_priv.h index b0a44bc7..3e02cf18 100644 --- a/src/libssh2_priv.h +++ b/src/libssh2_priv.h @@ -135,6 +135,7 @@ /* Use local implementation when not available */ #if !defined(HAVE_SNPRINTF) #define LIBSSH2_SNPRINTF +#undef snprintf #define snprintf _libssh2_snprintf int _libssh2_snprintf(char *cp, size_t cp_max_len, const char *fmt, ...); #endif