From dff4955ddec1d318a56997388f367186c5b8078c Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sun, 23 Sep 2018 17:34:29 +0200 Subject: [PATCH] Fix checks for Cygwin-related macros. The search-and-replace done in commit 0466160 broke compilation on Cygwin. Closes #198 on GitHub. --- src/getopt.c | 2 +- src/net_setup.c | 4 ++-- src/utils.c | 4 ++-- src/utils.h | 5 ++++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/getopt.c b/src/getopt.c index 1f6c27b..741c7f2 100644 --- a/src/getopt.c +++ b/src/getopt.c @@ -83,7 +83,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #endif #endif -#if defined (WIN32) && !defined (__CYGWIN32__32) +#if defined (WIN32) && !defined (__CYGWIN32__) /* It's not Unix, really. See? Capital letters. */ #include #define getpid() GetCurrentProcessId() diff --git a/src/net_setup.c b/src/net_setup.c index 8c43b39..cac7455 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -239,7 +239,7 @@ static bool read_rsa_private_key(void) { return false; } -#if !defined(HAVE_MINGW) && !defined(HAVE___CYGWIN32__) +#if !defined(HAVE_MINGW) && !defined(HAVE_CYGWIN) struct stat s; if(!fstat(fileno(fp), &s)) { @@ -860,7 +860,7 @@ static bool setup_myself(void) { #ifdef HAVE_MINGW Sleep(1000); #endif -#ifdef HAVE___CYGWIN32__ +#ifdef HAVE_CYGWIN sleep(1); #endif execute_script("tinc-up", envp); diff --git a/src/utils.c b/src/utils.c index 28f60e8..70a5c99 100644 --- a/src/utils.c +++ b/src/utils.c @@ -54,8 +54,8 @@ void bin2hex(char *src, char *dst, int length) { } } -#if defined(HAVE_MINGW) || defined(HAVE___CYGWIN32__) -#ifdef HAVE___CYGWIN32__ +#if defined(HAVE_MINGW) || defined(HAVE_CYGWIN) +#ifdef HAVE_CYGWIN #include #endif diff --git a/src/utils.h b/src/utils.h index fbeae5e..7952025 100644 --- a/src/utils.h +++ b/src/utils.h @@ -24,8 +24,11 @@ extern bool hex2bin(char *src, char *dst, int length); extern void bin2hex(char *src, char *dst, int length); -#ifdef HAVE_MINGW +#if defined(HAVE_MINGW) || defined(HAVE_CYGWIN) extern const char *winerror(int); +#endif + +#ifdef HAVE_MINGW #define strerror(x) ((x)>0?strerror(x):winerror(GetLastError())) #define sockerrno WSAGetLastError() #define sockstrerror(x) winerror(x) -- 2.25.1