Use POSIX getenv on Cygwin
authorErik M. Bray <erik.bray@lri.fr>
Fri, 15 Mar 2019 14:06:30 +0000 (15:06 +0100)
committerErik M. Bray <erik.bray@lri.fr>
Fri, 15 Mar 2019 14:06:30 +0000 (15:06 +0100)
The Windows-native GetEnvironmentVariable cannot be relied on, as
Cygwin does not always copy environment variables set through Cygwin
to the Windows environment block, particularly after fork().

common.h

index 7fcd5e3..f239c3d 100644 (file)
--- a/common.h
+++ b/common.h
@@ -439,7 +439,7 @@ please https://github.com/xianyi/OpenBLAS/issues/246
 typedef char env_var_t[MAX_PATH];
 #define readenv(p, n) 0
 #else
-#ifdef OS_WINDOWS
+#if defined(OS_WINDOWS) && !defined(OS_CYGWIN_NT)
 typedef char env_var_t[MAX_PATH];
 #define readenv(p, n) GetEnvironmentVariable((LPCTSTR)(n), (LPTSTR)(p), sizeof(p))
 #else