mirror of
https://github.com/git/git.git
synced 2026-04-01 12:30:09 +02: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:
@@ -157,6 +157,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, ...)
|
||||
{
|
||||
|
||||
@@ -112,14 +112,6 @@ static inline int fcntl(int fd, int cmd, long arg)
|
||||
* simple adaptors
|
||||
*/
|
||||
|
||||
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)
|
||||
@@ -175,6 +167,9 @@ int readlink(const char *path, char *buf, size_t bufsiz);
|
||||
int mingw_mkdir(const char *path, int mode);
|
||||
#define mkdir mingw_mkdir
|
||||
|
||||
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