Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<filesystem>::space fails with no read access to root #552

Merged
merged 10 commits into from
Mar 3, 2020
9 changes: 4 additions & 5 deletions stl/src/filesystem_space.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@ _EXTERN_C
_Last_error = __std_win_error{GetLastError()};
} else {
{
constexpr DWORD _Static_size = MAX_PATH;
wchar_t _Temp_buf[_Static_size];
_Last_error = _Fs_space_attempt(_Temp_buf, _Static_size, _Target, _Available, _Total_bytes, _Free_bytes);
if (_Last_error == __std_win_error::_Success) {
return __std_win_error::_Success;
if (GetDiskFreeSpaceExW(_Target, reinterpret_cast<PULARGE_INTEGER>(_Available),
mscottmueller marked this conversation as resolved.
Show resolved Hide resolved
reinterpret_cast<PULARGE_INTEGER>(_Total_bytes), reinterpret_cast<PULARGE_INTEGER>(_Free_bytes))) {
return _std_win_error::Success;
}
_Last_error = __std_win_error{GetLastError()}
}

if (_Last_error == __std_win_error::_Filename_exceeds_range) {
Expand Down