From: Heiko Voigt Date: Mon, 7 Feb 2011 20:49:33 +0000 (+0100) Subject: mingw: move unlink wrapper to mingw.c X-Git-Tag: v1.7.5-rc0~120^2~4 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=337967fb7794b300f1633a413c0db525ab517a3e;p=git.git mingw: move unlink wrapper to mingw.c The next patch implements a workaround in case unlink fails on Windows. Signed-off-by: Heiko Voigt Signed-off-by: Junio C Hamano --- 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, ...) { diff --git a/compat/mingw.h b/compat/mingw.h index 228307110..831693802 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -125,14 +125,6 @@ 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 - #define WNOHANG 1 pid_t waitpid(pid_t pid, int *status, unsigned options); @@ -180,6 +172,9 @@ int link(const char *oldpath, const char *newpath); * replacements of existing functions */ +int mingw_unlink(const char *pathname); +#define unlink mingw_unlink + int mingw_open (const char *filename, int oflags, ...); #define open mingw_open