From 3fae4ef8b228374c865bc0afcb1041eabae5a111 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 26 Jul 2017 01:56:22 +0300 Subject: Fix process ctor to consider environment variable name case-insensitivity on Windows --- libbutl/process.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'libbutl/process.cxx') diff --git a/libbutl/process.cxx b/libbutl/process.cxx index ed01ca1..6f6ea8e 100644 --- a/libbutl/process.cxx +++ b/libbutl/process.cxx @@ -49,7 +49,7 @@ #include // ios_base::failure #include #include // size_t -#include // strlen(), strchr(), strncmp() +#include // strlen(), strchr() #include // move() #include @@ -994,8 +994,10 @@ namespace butl // Lookup the existing variable among those that are requested to be // (un)set. If not present, than copy it to the new block. // - // Note that we don't expect the number of variables to (un)set to be - // large, so the linear search is OK. + // Note that on Windows variable names are case-insensitive. + // + // Alse note that we don't expect the number of variables to (un)set + // to be large, so the linear search is OK. // size_t n (strlen (cv) + 1); // Includes NULL character. @@ -1006,7 +1008,7 @@ namespace butl for (; *ev != nullptr; ++ev) { const char* v (*ev); - if (strncmp (cv, v, nn) == 0 && (v[nn] == '=' || v[nn] == '\0')) + if (casecmp (cv, v, nn) == 0 && (v[nn] == '=' || v[nn] == '\0')) break; } -- cgit v1.1