From aa3e33575d2098d5ca435b98d5c7fc29de57cece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 29 Aug 2018 20:37:55 +0200 Subject: [PATCH] Fixup Windows build after strerr changes --- lib/isc/include/isc/strerr.h | 4 ++-- lib/isc/string.c | 6 +++++- lib/isc/win32/errno2result.c | 1 + lib/isc/win32/include/isc/platform.h.in | 1 - lib/isc/win32/interfaceiter.c | 1 - lib/isc/win32/libisc.vcxproj.filters.in | 9 --------- lib/isc/win32/libisc.vcxproj.in | 3 --- lib/isc/win32/net.c | 2 +- lib/isc/win32/socket.c | 2 +- 9 files changed, 10 insertions(+), 19 deletions(-) diff --git a/lib/isc/include/isc/strerr.h b/lib/isc/include/isc/strerr.h index 40022ecd6d..e3e0304dab 100644 --- a/lib/isc/include/isc/strerr.h +++ b/lib/isc/include/isc/strerr.h @@ -17,7 +17,7 @@ #include -#if _GNU_SOURCE +#if defined(strerror_r) #undef strerror_r -#define strerror_r isc_string_strerror_r #endif +#define strerror_r isc_string_strerror_r diff --git a/lib/isc/string.c b/lib/isc/string.c index b1e42a0b57..46e5303166 100644 --- a/lib/isc/string.c +++ b/lib/isc/string.c @@ -44,8 +44,8 @@ #ifdef _GNU_SOURCE #undef _GNU_SOURCE -#include #endif +#include #include "isc/string.h" // IWYU pragma: keep @@ -109,5 +109,9 @@ isc_string_strlcat(char *dst, const char *src, size_t size) int isc_string_strerror_r(int errnum, char *buf, size_t buflen) { +#if defined(_WIN32) || defined(_WIN64) + return (strerror_s(buf, buflen, errnum)); +#else return (strerror_r(errnum, buf, buflen)); +#endif } diff --git a/lib/isc/win32/errno2result.c b/lib/isc/win32/errno2result.c index d24a1268b1..d09fc2b233 100644 --- a/lib/isc/win32/errno2result.c +++ b/lib/isc/win32/errno2result.c @@ -17,6 +17,7 @@ #include "errno2result.h" #include +#include #include #include diff --git a/lib/isc/win32/include/isc/platform.h.in b/lib/isc/win32/include/isc/platform.h.in index eea970e6a9..a0fc5c644a 100644 --- a/lib/isc/win32/include/isc/platform.h.in +++ b/lib/isc/win32/include/isc/platform.h.in @@ -28,7 +28,6 @@ #if defined(_WIN32) || defined(_WIN64) /* We are on Windows */ # define strtok_r strtok_s -# define strerror_r(errnum, buf, buflen) strerror_s(buf, buflen, errnum) #define ISC_STRERRORSIZE 128 diff --git a/lib/isc/win32/interfaceiter.c b/lib/isc/win32/interfaceiter.c index 3272c89ecf..da6d282b04 100644 --- a/lib/isc/win32/interfaceiter.c +++ b/lib/isc/win32/interfaceiter.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include diff --git a/lib/isc/win32/libisc.vcxproj.filters.in b/lib/isc/win32/libisc.vcxproj.filters.in index ff1c035ac2..bce90661fe 100644 --- a/lib/isc/win32/libisc.vcxproj.filters.in +++ b/lib/isc/win32/libisc.vcxproj.filters.in @@ -449,9 +449,6 @@ Win32 Source Files - - Win32 Source Files - Win32 Source Files @@ -538,12 +535,6 @@ Library Source Files - - Library Source Files - - - Library Source Files - Library Source Files diff --git a/lib/isc/win32/libisc.vcxproj.in b/lib/isc/win32/libisc.vcxproj.in index 376ab0cf0c..c32f5c8be7 100644 --- a/lib/isc/win32/libisc.vcxproj.in +++ b/lib/isc/win32/libisc.vcxproj.in @@ -437,8 +437,6 @@ copy InstallFiles ..\Build\Release\ - - @@ -497,7 +495,6 @@ copy InstallFiles ..\Build\Release\ - diff --git a/lib/isc/win32/net.c b/lib/isc/win32/net.c index 7328f8e54c..3ae2e4c3e6 100644 --- a/lib/isc/win32/net.c +++ b/lib/isc/win32/net.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include diff --git a/lib/isc/win32/socket.c b/lib/isc/win32/socket.c index ffcc0cc9e1..9add374881 100644 --- a/lib/isc/win32/socket.c +++ b/lib/isc/win32/socket.c @@ -62,7 +62,7 @@ #include #include #include -#include +#include #include #include #include