Fix setting of longer environmental variables on Windows

coverity_scan^2
David Cernat 8 years ago
parent 804259b2c9
commit 35de28e239

@ -14,12 +14,8 @@ using namespace std;
#ifdef _WIN32 #ifdef _WIN32
int setenv(const char *name, const char *value, int overwrite) int setenv(const char *name, const char *value, int overwrite)
{ {
std::unique_ptr<char> tmp(new char[strlen(name) + strlen(value) + 1]); printf("%s: %s\n", name, value);
sprintf(tmp.get(), "%s=%s", name, value); return _putenv_s(name, value);
printf("%s\n",tmp.get());
return putenv((const char*)tmp.get());
} }
#endif #endif

Loading…
Cancel
Save