summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-11-10 10:45:07 +0100
committerRichard Levitte <levitte@openssl.org>2020-11-13 09:35:31 +0100
commit256d41d4371720ccfe1a4fead6bd28ed5071bcdd (patch)
treed941b7d4d7c4d8183aeabf0b91019cd7db821102
parent105d01f1eb0e48ea24b430a0ac9636906a24cdbb (diff)
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 <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/13318)
-rw-r--r--crypto/bio/b_addr.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/crypto/bio/b_addr.c b/crypto/bio/b_addr.c
index 7515cf264b..841cc58100 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 <assert.h>
#include <string.h>