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

Chad Rosier mcrosier at apple.com
Fri Apr 26 17:57:59 PDT 2013


On Apr 26, 2013, at 5:34 PM, Sean Silva <silvas at purdue.edu> wrote:

> -  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.
> 

I believe you are correct, Sean.  How does revision 180658 look?

> -- Sean Silva

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


More information about the cfe-commits mailing list