Index: libs/filesystem/src/operations.cpp =================================================================== --- libs/filesystem/src/operations.cpp (revision 86799) +++ libs/filesystem/src/operations.cpp (working copy) @@ -1977,7 +1977,7 @@ dirent * result; int return_code; if ((return_code = readdir_r_simulator(static_cast(handle), entry, &result))!= 0) - return error_code(errno, system_category()); + return error_code(return_code, system_category()); if (result == 0) return fs::detail::dir_itr_close(handle, buffer); target = entry->d_name;