@matheusbsbs / matheus-bagliano / commits / 132a6e903f
Fork 0

Windows: always chmod(, 0666) before unlink().

On Windows, 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 <Johannes.Schindelin@gmx.de> Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>

Johannes Schindelin committed Jan 23, 2007 at 13:39 UTC 132a6e903fd912d02392db55c407267103766f19
1 file changed +8
compat/mingw.h
+8
@@ -106,6 +106,14 @@ static inline int mingw_mkdir(const char *path, int mode)
106 }
107 #define mkdir mingw_mkdir
108
109 +static inline int mingw_unlink(const char *pathname)
110 +{
111 + /* read-only files cannot be removed */
112 + chmod(pathname, 0666);
113 + return unlink(pathname);
114 +}
115 +#define unlink mingw_unlink
116 +
117 static inline int waitpid(pid_t pid, unsigned *status, unsigned options)
118 {
119 if (options == 0)