aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2018-06-21 10:07:56 +0200
committerJohn Högberg <[email protected]>2018-06-21 12:34:33 +0200
commit718fcf2637aa1a2231399c03ae6984bb6143ffaf (patch)
tree4228788bb3885bc84f25871801d20c1bc6e8f775 /erts/emulator/sys
parenta0ae44f324576104760a63fe6cf63e0ca31756fc (diff)
downloadotp-718fcf2637aa1a2231399c03ae6984bb6143ffaf.tar.gz
otp-718fcf2637aa1a2231399c03ae6984bb6143ffaf.tar.bz2
otp-718fcf2637aa1a2231399c03ae6984bb6143ffaf.zip
Fix environment case sensitivity issues on Windows
Diffstat (limited to 'erts/emulator/sys')
-rw-r--r--erts/emulator/sys/common/erl_osenv.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/erts/emulator/sys/common/erl_osenv.c b/erts/emulator/sys/common/erl_osenv.c
index 9f54d1dff0..487ff87116 100644
--- a/erts/emulator/sys/common/erl_osenv.c
+++ b/erts/emulator/sys/common/erl_osenv.c
@@ -75,7 +75,15 @@ static int compare_env_keys(const erts_osenv_data_t a, const erts_osenv_data_t b
#include "erl_rbtree.h"
static int compare_env_keys(const erts_osenv_data_t a, const erts_osenv_data_t b) {
- int relation = sys_memcmp(a.data, b.data, MIN(a.length, b.length));
+ int relation;
+
+#ifdef __WIN32__
+ /* Environment variables are case-insensitive on Windows. */
+ relation = _wcsnicmp((const WCHAR*)a.data, (const WCHAR*)b.data,
+ MIN(a.length, b.length) / sizeof(WCHAR));
+#else
+ relation = sys_memcmp(a.data, b.data, MIN(a.length, b.length));
+#endif
if(relation != 0) {
return relation;