From: Richard Levitte Date: Tue, 10 Nov 2020 09:45:07 +0000 (+0100) Subject: BIO: Undefine UNICODE in b_addr.c to get POSIX declaration of gai_strerror() X-Git-Tag: openssl-3.0.0-alpha9~106 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=256d41d4371720ccfe1a4fead6bd28ed5071bcdd;p=thirdparty%2Fopenssl.git BIO: Undefine UNICODE in b_addr.c to get POSIX declaration of gai_strerror() When UNICODE is defined, Windows headers push for WCHAR implementations, which aren't compatible with POSIX declarations. Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/13318) --- diff --git a/crypto/bio/b_addr.c b/crypto/bio/b_addr.c index 7515cf264b1..841cc581004 100644 --- a/crypto/bio/b_addr.c +++ b/crypto/bio/b_addr.c @@ -11,6 +11,16 @@ # define _GNU_SOURCE #endif +/* + * VC configurations may define UNICODE, to indicate to the C RTL that + * WCHAR functions are preferred. + * This affects functions like gai_strerror(), which is implemented as + * an alias macro for gai_strerrorA() (which returns a const char *) or + * gai_strerrorW() (which returns a const WCHAR *). This source file + * assumes POSIX declarations, so prefer the non-UNICODE definitions. + */ +#undef UNICODE + #include #include