mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 03:08:31 +00:00
Remove exponential backoff from chdir()
This issue probably only impacted the earliest releases of Windows 7 and we only support Windows 10+ these days, so it's not worth adding 2000 ms of startup latency to vim when ~/.vim doesn't exist.
This commit is contained in:
parent
4d05060aac
commit
deb5e07b5a
2 changed files with 23 additions and 46 deletions
|
@ -57,15 +57,14 @@ static textwindows bool IsDirectorySymlink(const char16_t *path) {
|
|||
static textwindows int sys_rmdir_nt(const char16_t *path) {
|
||||
int ms;
|
||||
for (ms = 1;; ms *= 2) {
|
||||
if (RemoveDirectory(path)) {
|
||||
if (RemoveDirectory(path))
|
||||
return 0;
|
||||
}
|
||||
// Files can linger, for absolutely no reason.
|
||||
// Possibly some Windows Defender bug on Win7.
|
||||
// Sleep for up to one second w/ expo backoff.
|
||||
// Alternative is use Microsoft internal APIs.
|
||||
// Never could have imagined it'd be this bad.
|
||||
if (GetLastError() == kNtErrorDirNotEmpty && ms <= 2048) {
|
||||
if (GetLastError() == kNtErrorDirNotEmpty && ms <= 1024) {
|
||||
Sleep(ms);
|
||||
continue;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue