aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/environ.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/environ.cc')
-rw-r--r--winsup/cygwin/environ.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 2f8e350..25985e6 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -22,6 +22,7 @@ details. */
#include "fhandler.h"
#include "path.h"
#include "cygerrno.h"
+#include "dtable.h"
#include "cygheap.h"
#include "registry.h"
#include "environ.h"
@@ -105,7 +106,7 @@ getwinenv (const char *env, const char *in_posix)
return NULL;
for (int i = 0; conv_envvars[i].name != NULL; i++)
- if (strncasematch (env, conv_envvars[i].name, conv_envvars[i].namelen))
+ if (strncmp (env, conv_envvars[i].name, conv_envvars[i].namelen) == 0)
{
win_env *we = conv_envvars + i;
const char *val;
@@ -735,10 +736,14 @@ winenv (const char * const *envp, int keep_posix)
len = strcspn (*srcp, "=") + 1;
win_env *conv;
- if (!keep_posix && (conv = getwinenv (*srcp, *srcp + len)))
- *dstp = conv->native;
- else
+ if (keep_posix || !(conv = getwinenv (*srcp, *srcp + len)))
*dstp = *srcp;
+ else
+ {
+ char *p = (char *) alloca (strlen (conv->native) + 1);
+ strcpy (p, conv->native);
+ *dstp = p;
+ }
tl += strlen (*dstp) + 1;
if ((*dstp)[0] == '!' && isdrive ((*dstp) + 1) && (*dstp)[3] == '=')
{