diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2011-03-24 05:23:40 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2011-03-24 05:23:40 +0000 |
commit | e1db1b8d4ee9c7584a2c1b3c79b0c01e468398dc (patch) | |
tree | 7471b480b8ecdc1cc01108b1f2544d7fc6ad89b0 /lib/Support/Unix | |
parent | 6e8ffc1c4d73e6c91aca9ac28ef5859ead26e2b6 (diff) |
Remove all uses of PATH_MAX and MAXPATHLEN from PathV2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128199 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Unix')
-rw-r--r-- | lib/Support/Unix/PathV2.inc | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/Support/Unix/PathV2.inc b/lib/Support/Unix/PathV2.inc index 03ff28367e..c9267c06b3 100644 --- a/lib/Support/Unix/PathV2.inc +++ b/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; } |