aboutsummaryrefslogtreecommitdiff
path: root/compat/mingw.c
diff options
context:
space:
mode:
authorHeiko Voigt <hvoigt@hvoigt.net>2011-02-07 21:49:33 +0100
committerJunio C Hamano <gitster@pobox.com>2011-02-07 15:45:54 -0800
commit337967fb7794b300f1633a413c0db525ab517a3e (patch)
treed871be95ea017e4941687b6c387f0a8d0830e9b9 /compat/mingw.c
parentb5c178143088350c49129acbedb864d70c666215 (diff)
downloadgit-337967fb7794b300f1633a413c0db525ab517a3e.tar.gz
git-337967fb7794b300f1633a413c0db525ab517a3e.tar.xz
mingw: move unlink wrapper to mingw.c
The next patch implements a workaround in case unlink fails on Windows. Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/mingw.c')
-rw-r--r--compat/mingw.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index bee605441..a7e1c6b47 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -116,6 +116,14 @@ int err_win_to_posix(DWORD winerr)
return error;
}
+#undef unlink
+int mingw_unlink(const char *pathname)
+{
+ /* read-only files cannot be removed */
+ chmod(pathname, 0666);
+ return unlink(pathname);
+}
+
#undef open
int mingw_open (const char *filename, int oflags, ...)
{