Add exponential backoff to rmdir() on Windows

This commit is contained in:
Justine Tunney 2021-01-29 21:46:23 -08:00
parent bf8b1623c8
commit eaca5b3e81
7 changed files with 38 additions and 16 deletions

View file

@ -37,7 +37,12 @@ static int rmrfdir(const char *dirpath) {
if (!strcmp(e->d_name, "..")) continue;
if (strchr(e->d_name, '/')) abort();
path = xjoinpaths(dirpath, e->d_name);
if ((e->d_type == DT_DIR ? rmrfdir(path) : unlink(path)) == -1) {
if (e->d_type == DT_DIR) {
rc = rmrfdir(path);
} else {
rc = unlink(path);
}
if (rc == -1) {
free(path);
closedir(d);
return -1;