fix(libc): map directory symlink loop errors

(cherry picked from commit d5e348c7b6)
This commit is contained in:
MarcZX100 committed 2026-10-10 18:24:36 +00:00
1 parent df6b831400
commit c96100aff1
2 files changed
+10

No files matched your search

+3
View File
@@ -17,6 +17,9 @@ int DirectoryError(int error) {
case ENFILE: return 23;
case ENOMEM: return 12;
case ENAMETOOLONG: return 63;
#ifdef ELOOP
case ELOOP: return 62;
#endif
default: return 5;
}
}
+7
View File
@@ -42,6 +42,13 @@ int main() {
Require(closedir_nid_postfix(directory) == 0);
Require(opendir_nid_postfix((root / "missing").string().c_str()) == nullptr);
Require(*__error_nid_postfix() == 2);
#ifndef _WIN32
const auto symlinkLoop = root / "symlink-loop";
std::filesystem::create_symlink("symlink-loop", symlinkLoop);
Require(opendir_nid_postfix(symlinkLoop.string().c_str()) == nullptr);
Require(*__error_nid_postfix() == 62);
Require(std::filesystem::remove(symlinkLoop));
#endif
Require(opendir_nid_postfix((root / "sample.txt").string().c_str()) == nullptr);
Require(*__error_nid_postfix() == 20);
Require(opendir_nid_postfix("") == nullptr && *__error_nid_postfix() == 2);