diff --git a/compat/mingw.c b/compat/mingw.c index cb0914af6c..f6c7ad7fd8 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -1220,14 +1220,14 @@ static char **env_setenv(char **env, const char *name) for (i = 0; env[i]; i++) ; env = xrealloc(env, (i+2)*sizeof(*env)); - env[i] = xstrdup(name); + env[i] = (char*) name; env[i+1] = NULL; } } else { free(env[i]); if (*eq) - env[i] = xstrdup(name); + env[i] = (char*) name; else for (; env[i]; i++) env[i] = env[i+1]; @@ -1242,8 +1242,10 @@ char **make_augmented_environ(const char *const *vars) { char **env = copy_environ(); - while (*vars) - env = env_setenv(env, *vars++); + while (*vars) { + const char *v = *vars++; + env = env_setenv(env, strchr(v, '=') ? xstrdup(v) : v); + } return env; } diff --git a/compat/mingw.h b/compat/mingw.h index ca80be1bbe..828d97760c 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -209,6 +209,7 @@ char *mingw_getenv(const char *name); #define getenv mingw_getenv int mingw_putenv(const char *namevalue); #define putenv mingw_putenv +#define unsetenv mingw_putenv int mingw_gethostname(char *host, int namelen); #define gethostname mingw_gethostname diff --git a/config.mak.uname b/config.mak.uname index 8131c81985..462988e8ab 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -326,7 +326,6 @@ ifeq ($(uname_S),Windows) NO_IPV6 = YesPlease NO_UNIX_SOCKETS = YesPlease NO_SETENV = YesPlease - NO_UNSETENV = YesPlease NO_STRCASESTR = YesPlease NO_STRLCPY = YesPlease NO_MEMMEM = YesPlease @@ -479,7 +478,6 @@ ifneq (,$(findstring MINGW,$(uname_S))) NO_SYMLINK_HEAD = YesPlease NO_UNIX_SOCKETS = YesPlease NO_SETENV = YesPlease - NO_UNSETENV = YesPlease NO_STRCASESTR = YesPlease NO_STRLCPY = YesPlease NO_MEMMEM = YesPlease