summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2007-01-23 12:39:09 (GMT)
committerJohannes Sixt <johannes.sixt@telecom.at>2008-06-23 11:38:23 (GMT)
commit132a6e903fd912d02392db55c407267103766f19 (patch)
treea19ffa4904b2d5b775f6111844becf7bc97e2f7d /compat
parentf7597acac069bbaad8887cb315a4e5420222971a (diff)
downloadgit-132a6e903fd912d02392db55c407267103766f19.zip
git-132a6e903fd912d02392db55c407267103766f19.tar.gz
git-132a6e903fd912d02392db55c407267103766f19.tar.bz2
Windows: always chmod(, 0666) before unlink().
On Windows, read-only files cannot be deleted. To make sure that deletion does not fail because of this, always call chmod() before unlink(). Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Diffstat (limited to 'compat')
-rw-r--r--compat/mingw.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/compat/mingw.h b/compat/mingw.h
index 901cfa7..95a08b4 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -106,6 +106,14 @@ static inline int mingw_mkdir(const char *path, int mode)
}
#define mkdir mingw_mkdir
+static inline int mingw_unlink(const char *pathname)
+{
+ /* read-only files cannot be removed */
+ chmod(pathname, 0666);
+ return unlink(pathname);
+}
+#define unlink mingw_unlink
+
static inline int waitpid(pid_t pid, unsigned *status, unsigned options)
{
if (options == 0)