summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Unix/PathV2.inc
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2011-03-24 05:23:40 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2011-03-24 05:23:40 +0000
commite42162ad597a2e1009cb05846611795068a1782e (patch)
treef0672ca3c8d23e8c91cb2616b62249bc2b0cce57 /llvm/lib/Support/Unix/PathV2.inc
parentb4d3c999295a01785d1c4442e05ba127571dbdc4 (diff)
downloadbcm5719-llvm-e42162ad597a2e1009cb05846611795068a1782e.tar.gz
bcm5719-llvm-e42162ad597a2e1009cb05846611795068a1782e.zip
Remove all uses of PATH_MAX and MAXPATHLEN from PathV2.
llvm-svn: 128199
Diffstat (limited to 'llvm/lib/Support/Unix/PathV2.inc')
-rw-r--r--llvm/lib/Support/Unix/PathV2.inc14
1 files changed, 5 insertions, 9 deletions
diff --git a/llvm/lib/Support/Unix/PathV2.inc b/llvm/lib/Support/Unix/PathV2.inc
index 03ff28367e4..c9267c06b39 100644
--- a/llvm/lib/Support/Unix/PathV2.inc
+++ b/llvm/lib/Support/Unix/PathV2.inc
@@ -93,7 +93,8 @@ namespace sys {
namespace fs {
error_code current_path(SmallVectorImpl<char> &result) {
- result.reserve(MAXPATHLEN);
+ // Reserve an arbitrary amount of space.
+ result.reserve(128);
while (true) {
if (::getcwd(result.data(), result.capacity()) == 0) {
@@ -417,18 +418,13 @@ rety_open_create:
}
// Make the path absolute.
- char real_path_buff[PATH_MAX + 1];
- if (realpath(RandomPath.c_str(), real_path_buff) == NULL) {
- int error = errno;
+ if (error_code ec = make_absolute(RandomPath)) {
::close(RandomFD);
::unlink(RandomPath.c_str());
- return error_code(error, system_category());
+ return ec;
}
- result_path.clear();
- StringRef d(real_path_buff);
- result_path.append(d.begin(), d.end());
-
+ result_path = RandomPath;
result_fd = RandomFD;
return success;
}
OpenPOWER on IntegriCloud