提交 337967fb 编写于 作者: H Heiko Voigt 提交者: Junio C Hamano

mingw: move unlink wrapper to mingw.c

The next patch implements a workaround in case unlink fails on Windows.
Signed-off-by: NHeiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 b5c17814
......@@ -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, ...)
{
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册