Add special errno handling to libcxx

This commit is contained in:
Justine Tunney 2024-07-25 01:05:39 -07:00
parent 0f486a13c8
commit 2c4b88753b
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
10 changed files with 235 additions and 7 deletions

View file

@ -118,7 +118,11 @@ public:
if ((__stream_ = ::opendir(root.c_str())) == nullptr) {
ec = detail::capture_errno();
const bool allow_eacces = bool(opts & directory_options::skip_permission_denied);
#ifdef __COSMOPOLITAN__
if (allow_eacces && ec.value() == (int)errc::permission_denied)
#else
if (allow_eacces && ec.value() == EACCES)
#endif
ec.clear();
return;
}
@ -307,7 +311,11 @@ bool recursive_directory_iterator::__try_recursion(error_code* ec) {
}
if (m_ec) {
const bool allow_eacess = bool(__imp_->__options_ & directory_options::skip_permission_denied);
#ifdef __COSMOPOLITAN__
if (m_ec.value() == (int)errc::permission_denied && allow_eacess) {
#else
if (m_ec.value() == EACCES && allow_eacess) {
#endif
if (ec)
ec->clear();
} else {