summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarson Howard <carsonh@axosoft.com>2017-07-18 14:47:28 -0700
committerEdward Thomson <ethomson@edwardthomson.com>2017-07-26 10:40:30 +0100
commit1bcdaba2bc87d12cf7666ee1b2c238ccc92024f2 (patch)
treea6c6f8aea0a8d52c45529a6bac599681fb7bc7ae
parent8149f850ca98e56cc56f7f66aa9fbb6c04801152 (diff)
downloadlibgit2-1bcdaba2bc87d12cf7666ee1b2c238ccc92024f2.tar.gz
fixed win32 p_unlink retry sleep issue
Fixed an issue where the retry logic on p_unlink sleeps before it tries setting a file to write mode causing unnecessary slowdown.
-rw-r--r--src/win32/posix_w32.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c
index e4fe4142c..32fafa8ed 100644
--- a/src/win32/posix_w32.c
+++ b/src/win32/posix_w32.c
@@ -243,6 +243,11 @@ GIT_INLINE(int) unlink_once(const wchar_t *path)
if (DeleteFileW(path))
return 0;
+ set_errno();
+
+ if (errno == EACCES && ensure_writable(path) == 0 && DeleteFileW(path))
+ return 0;
+
if (last_error_retryable())
return GIT_RETRY;
@@ -257,7 +262,7 @@ int p_unlink(const char *path)
if (git_win32_path_from_utf8(wpath, path) < 0)
return -1;
- do_with_retries(unlink_once(wpath), ensure_writable(wpath));
+ do_with_retries(unlink_once(wpath), 0);
}
int p_fsync(int fd)