Putenv requires a char *, for some reason.

This commit is contained in:
Jean-Marc Lasgouttes 2013-03-28 14:02:21 +01:00
parent 5fbbd863db
commit 3231ab7d70

View File

@ -129,10 +129,10 @@ bool unsetEnv(string const & name)
{
#if defined(HAVE_UNSETENV)
// FIXME: does it leak?
return unsetenv(name.c_str()) == 0;
return ::unsetenv(name.c_str()) == 0;
#elif defined(HAVE_PUTENV)
// This is OK with MSVC and MinGW at least.
return putenv((name + "=").c_str()) == 0;
return ::putenv(const_cast<char*>((name + "=").c_str())) == 0;
#else
#error No environment-unsetting function has been defined.
#endif