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:
@@ -602,7 +602,8 @@ void __permissions(const path& p, perms prms, std::error_code *ec)
|
|||||||
"Both add_perms and remove_perms are set");
|
"Both add_perms and remove_perms are set");
|
||||||
|
|
||||||
std::error_code m_ec;
|
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);
|
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
|
// AT_SYMLINK_NOFOLLOW can only be used on symlinks, using it on a regular
|
||||||
|
|||||||
Reference in New Issue
Block a user