mirror of
https://github.com/git/git.git
synced 2026-01-19 23:20:34 +00:00
mingw: move unlink wrapper to mingw.c
The next patch implements a workaround in case unlink fails on Windows. Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
This commit is contained in:
committed by
Johannes Schindelin
parent
d8b06b7dc7
commit
4ca6bb2d6e
@@ -155,6 +155,14 @@ int mingw_mkdir(const char *path, int mode)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#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, ...)
|
||||
{
|
||||
|
||||
@@ -119,14 +119,6 @@ static inline int fcntl(int fd, int cmd, ...)
|
||||
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 pid_t waitpid(pid_t pid, int *status, unsigned options)
|
||||
{
|
||||
if (options == 0)
|
||||
@@ -177,6 +169,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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user