diff options
author | Nick Mathewson <nickm@torproject.org> | 2021-11-05 12:08:48 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2021-11-05 12:36:34 -0400 |
commit | c93114ec9e45f4fb3843012056046eec15b875aa (patch) | |
tree | 80cb7a61e78f4d0d37d308534cb1b5646231338b /src/lib/string | |
parent | 1c77deca4f8e8027eaf130b6454af758e4d9ccc4 (diff) | |
download | tor-c93114ec9e45f4fb3843012056046eec15b875aa.tar.gz tor-c93114ec9e45f4fb3843012056046eec15b875aa.zip |
Prefer use of __MINGW_PRINTF/SCANF_FORMAT if available.
Mingw headers sometimes like to define alternative scanf/printf
format attributes depending on whether they're using clang, UCRT,
MINGW_ANSI_STDIO, or the microsoft version of printf/scanf. This
change attempts to use the right one on the given platform.
This is an attempt to fix part of #40355.
Diffstat (limited to 'src/lib/string')
-rw-r--r-- | src/lib/string/printf.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/string/printf.c b/src/lib/string/printf.c index 62758093a7..bd35b76d1b 100644 --- a/src/lib/string/printf.c +++ b/src/lib/string/printf.c @@ -8,9 +8,9 @@ * \brief Compatibility wrappers around snprintf and its friends **/ +#include "lib/cc/torint.h" #include "lib/string/printf.h" #include "lib/err/torerr.h" -#include "lib/cc/torint.h" #include "lib/malloc/malloc.h" #include <stdlib.h> @@ -45,7 +45,7 @@ tor_vsnprintf(char *str, size_t size, const char *format, va_list args) return -1; /* no place for the NUL */ if (size > SIZE_T_CEILING) return -1; -#ifdef _WIN32 +#if defined(_WIN32) && !defined(HAVE_VSNPRINTF) r = _vsnprintf(str, size, format, args); #else r = vsnprintf(str, size, format, args); |