Commit 5ca03af6 authored by Brad King's avatar Brad King
Browse files

SystemTools: Revert "Reduce scope of 'buf' variable in CollapseFullPath"

Revert commit 6e36d909 (SystemTools: Reduce scope of 'buf' variable in
CollapseFullPath, 2019-06-18).  A pointer to the buffer is returned by
`Getcwd` and stored in `res_in_base`.  The buffer must remain valid for
the lifetime of that variable.
parent 6c3dfd25
......@@ -3411,9 +3411,9 @@ std::string SystemTools::CollapseFullPath(const std::string& in_path,
const char* in_base)
// Use the current working directory as a base path.
char buf[2048];
const char* res_in_base = in_base;
if (!res_in_base) {
char buf[2048];
if (const char* cwd = Getcwd(buf, 2048)) {
res_in_base = cwd;
} else {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment