Documentation: remove unnecessary backslashes
[gitweb.git] / wrapper.c
index b43d437630c9245a6a48a0940df1607e21357362..29a45d2654e982dbbb3fc328e16c01713d8a7fb5 100644 (file)
--- a/wrapper.c
+++ b/wrapper.c
@@ -391,6 +391,19 @@ FILE *xfdopen(int fd, const char *mode)
        return stream;
 }
 
+FILE *fopen_for_writing(const char *path)
+{
+       FILE *ret = fopen(path, "w");
+
+       if (!ret && errno == EPERM) {
+               if (!unlink(path))
+                       ret = fopen(path, "w");
+               else
+                       errno = EPERM;
+       }
+       return ret;
+}
+
 int xmkstemp(char *template)
 {
        int fd;