From: Johannes Sixt Date: Wed, 27 Feb 2008 18:54:31 GMT Subject: [PATCH 08/40] Windows: always chmod(, 0666) before unlink(). Message-ID: <1204138503-6126-9-git-send-email-johannes.sixt@telecom.at> In-Reply-To: <1204138503-6126-1-git-send-email-johannes.sixt@telecom.at> From: Johannes Schindelin From: Johannes Schindelin On Windows, a 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 --- git-compat-util.h | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/git-compat-util.h b/git-compat-util.h index 672c074..06ac2c1 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -551,6 +551,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) -- 1.5.4.1.126.ge5a7d