We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 97842f5 + dc97023 commit a94642cCopy full SHA for a94642c
src/libstd/sys/windows/os.rs
@@ -338,9 +338,9 @@ pub fn home_dir() -> Option<PathBuf> {
338
let _handle = Handle::new(token);
339
super::fill_utf16_buf(|buf, mut sz| {
340
match c::GetUserProfileDirectoryW(token, buf, &mut sz) {
341
- 0 if c::GetLastError() != 0 => 0,
+ 0 if c::GetLastError() != c::ERROR_INSUFFICIENT_BUFFER => 0,
342
0 => sz,
343
- n => n as c::DWORD,
+ _ => sz - 1, // sz includes the null terminator
344
}
345
}, super::os2path).ok()
346
})
0 commit comments