diff options
| author | Andrew Trick <atrick@apple.com> | 2011-03-24 16:43:37 +0000 |
|---|---|---|
| committer | Andrew Trick <atrick@apple.com> | 2011-03-24 16:43:37 +0000 |
| commit | a4ec5b2c19acafaea749c8952344ac766f0d08de (patch) | |
| tree | 111e14e290f8b486f64f487d8322036c4022cc4a /llvm/lib/Support | |
| parent | 74157ab3e5e1b8f601ef545b67725c1da4ba2fb5 (diff) | |
| download | bcm5719-llvm-a4ec5b2c19acafaea749c8952344ac766f0d08de.tar.gz bcm5719-llvm-a4ec5b2c19acafaea749c8952344ac766f0d08de.zip | |
revert r128199 until it can be made to work with Frontend/dependency-gen.c.
llvm-svn: 128218
Diffstat (limited to 'llvm/lib/Support')
| -rw-r--r-- | llvm/lib/Support/Unix/PathV2.inc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/Support/Unix/PathV2.inc b/llvm/lib/Support/Unix/PathV2.inc index c9267c06b39..03ff28367e4 100644 --- a/llvm/lib/Support/Unix/PathV2.inc +++ b/llvm/lib/Support/Unix/PathV2.inc @@ -93,8 +93,7 @@ namespace sys { namespace fs { error_code current_path(SmallVectorImpl<char> &result) { - // Reserve an arbitrary amount of space. - result.reserve(128); + result.reserve(MAXPATHLEN); while (true) { if (::getcwd(result.data(), result.capacity()) == 0) { @@ -418,13 +417,18 @@ rety_open_create: } // Make the path absolute. - if (error_code ec = make_absolute(RandomPath)) { + char real_path_buff[PATH_MAX + 1]; + if (realpath(RandomPath.c_str(), real_path_buff) == NULL) { + int error = errno; ::close(RandomFD); ::unlink(RandomPath.c_str()); - return ec; + return error_code(error, system_category()); } - result_path = RandomPath; + result_path.clear(); + StringRef d(real_path_buff); + result_path.append(d.begin(), d.end()); + result_fd = RandomFD; return success; } |

