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
This commit is contained in:
Eric Fiselier
2016-06-22 07:24:00 +00:00
parent 420dea528a
commit e1a1a1ffb7

View File

@@ -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