FileSystem: Get rid of trailing nulls in GetWorkingDirectory()
This commit is contained in:
parent
fa9e50d7c1
commit
592a591b5f
|
@ -2480,11 +2480,17 @@ std::string GetWorkingDirectory()
|
||||||
while (!getcwd(buffer.data(), buffer.size()))
|
while (!getcwd(buffer.data(), buffer.size()))
|
||||||
{
|
{
|
||||||
if (errno != ERANGE)
|
if (errno != ERANGE)
|
||||||
return {};
|
{
|
||||||
|
buffer.clear();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
buffer.resize(buffer.size() * 2);
|
buffer.resize(buffer.size() * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!buffer.empty())
|
||||||
|
buffer.resize(std::strlen(buffer.c_str()));
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue