Skip to content

Commit c7d46f2

Browse files
committed
[libcxx] Use the allocating form of getcwd() on Glibc and Apple platforms
This avoids having to query pathconf for a max size for preallocating a buffer for the return value. This is an extension to the POSIX getcwd() spec. Differential Revision: https://reviews.llvm.org/D97460
1 parent fb2e4f5 commit c7d46f2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libcxx/src/filesystem/operations.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ void __create_symlink(path const& from, path const& to, error_code* ec) {
10951095
path __current_path(error_code* ec) {
10961096
ErrorHandler<path> err("current_path", ec);
10971097

1098-
#if defined(_LIBCPP_WIN32API)
1098+
#if defined(_LIBCPP_WIN32API) || defined(__GLIBC__) || defined(__APPLE__)
10991099
// Common extension outside of POSIX getcwd() spec, without needing to
11001100
// preallocate a buffer. Also supported by a number of other POSIX libcs.
11011101
int size = 0;

0 commit comments

Comments
 (0)