aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-07-26 01:56:22 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-07-26 01:56:22 +0300
commit3fae4ef8b228374c865bc0afcb1041eabae5a111 (patch)
treedec9fcf95cae9f5006d54063dbfab9bb13a0a5ab
parent90e4f3c37b097d71176e20b530b83a5dc31e3d42 (diff)
Fix process ctor to consider environment variable name case-insensitivity on Windows
-rw-r--r--libbutl/process.cxx10
1 files changed, 6 insertions, 4 deletions
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> // ios_base::failure
#include <cassert>
#include <cstddef> // size_t
-#include <cstring> // strlen(), strchr(), strncmp()
+#include <cstring> // strlen(), strchr()
#include <utility> // move()
#include <ostream>
@@ -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;
}