[llvm-commits] [llvm] r128218 - /llvm/trunk/lib/Support/Unix/PathV2.inc
Andrew Trick
atrick at apple.com
Thu Mar 24 09:43:38 PDT 2011
Author: atrick
Date: Thu Mar 24 11:43:37 2011
New Revision: 128218
URL: http://llvm.org/viewvc/llvm-project?rev=128218&view=rev
Log:
revert r128199 until it can be made to work with Frontend/dependency-gen.c.
Modified:
llvm/trunk/lib/Support/Unix/PathV2.inc
Modified: llvm/trunk/lib/Support/Unix/PathV2.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/PathV2.inc?rev=128218&r1=128217&r2=128218&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/PathV2.inc (original)
+++ llvm/trunk/lib/Support/Unix/PathV2.inc Thu Mar 24 11:43:37 2011
@@ -93,8 +93,7 @@
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 @@
}
// 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;
}
More information about the llvm-commits
mailing list