r180652 - [driver] Use the llvm equivalent of getcwd(). Hopefully, this makes the Windows

Sean Silva silvas at purdue.edu
Fri Apr 26 17:34:34 PDT 2013


-  char cwd[MAXPATHLEN];
-  if (pwd && ::getcwd(cwd, MAXPATHLEN)) {
+  const char *cwd = llvm::sys::Path::GetCurrentDirectory().c_str();
+  if (pwd && cwd) {

I don't think this is safe. GetCurrentDirectory returns a Path by value
(which lives until the end of the statement), and the c_str() points into
that Path.

-- Sean Silva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130426/2fb78567/attachment.html>


More information about the cfe-commits mailing list