From e1a1a1ffb7ff3722ce697dada8eeebc03c6ca542 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Wed, 22 Jun 2016 07:24:00 +0000 Subject: [PATCH] Avoid unnecessary stat call in filesystem::permissions implementation. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273391 91177308-0d34-0410-b5e6-96231b3b80d8 --- src/experimental/filesystem/operations.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/experimental/filesystem/operations.cpp b/src/experimental/filesystem/operations.cpp index 4e7b233e6..ba57d2001 100644 --- a/src/experimental/filesystem/operations.cpp +++ b/src/experimental/filesystem/operations.cpp @@ -602,7 +602,8 @@ void __permissions(const path& p, perms prms, std::error_code *ec) "Both add_perms and remove_perms are set"); std::error_code m_ec; - file_status st = detail::posix_lstat(p, &m_ec); + file_status st = resolve_symlinks ? detail::posix_stat(p, &m_ec) + : detail::posix_lstat(p, &m_ec); if (m_ec) return set_or_throw(m_ec, ec, "permissions", p); // AT_SYMLINK_NOFOLLOW can only be used on symlinks, using it on a regular