Skip to content

Commit

Permalink
Merge pull request #2589 from jeffhostetler/unlink-perf-gfw
Browse files Browse the repository at this point in the history
mingw: improve performance of mingw_unlink()
  • Loading branch information
jeffhostetler authored and dscho committed Sep 24, 2020
2 parents 587f5b3 + 2b51c9d commit 8e57d9e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compat/mingw.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ int mingw_unlink(const char *pathname)
if (xutftowcs_path(wpathname, pathname) < 0)
return -1;

if (DeleteFileW(wpathname))
return 0;

/* read-only files cannot be removed */
_wchmod(wpathname, 0666);
while ((ret = _wunlink(wpathname)) == -1 && tries < ARRAY_SIZE(delay)) {
Expand Down

0 comments on commit 8e57d9e

Please sign in to comment.