From 132a6e903fd912d02392db55c407267103766f19 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 23 Jan 2007 13:39:09 +0100 Subject: 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 Signed-off-by: Johannes Sixt --- compat/mingw.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'compat') diff --git a/compat/mingw.h b/compat/mingw.h index 901cfa7c8..95a08b412 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) -- cgit v1.2.1