Do not modify string returned by getenv on Windows.

Fixes PR9875, patch by Nikola Smiljanic!

llvm-svn: 135356
This commit is contained in:
Francois Pichet
2011-07-16 21:17:14 +00:00
parent dc7d3c121b
commit 8e122b9fca

View File

@@ -420,10 +420,8 @@ static bool getVisualStudioDir(std::string &path) {
vscomntools = vs80comntools;
if (vscomntools && *vscomntools) {
char *p = const_cast<char *>(strstr(vscomntools, "\\Common7\\Tools"));
if (p)
*p = '\0';
path = vscomntools;
const char *p = strstr(vscomntools, "\\Common7\\Tools");
path = p ? std::string(vscomntools, p) : vscomntools;
return true;
}
return false;