Fix total permission bogosity in "checkout-cache.c".
[gitweb.git] / checkout-cache.c
index 09b36b9c77e5ed3b833f7ede502640a966373f49..b909f5d9a0ec10c99b850bf794cb7a4191cd0740 100644 (file)
@@ -54,7 +54,7 @@ static int create_file(const char *path, unsigned int mode)
 {
        int fd;
 
-       mode = (mode & 0100) ? 777 : 666;
+       mode = (mode & 0100) ? 0777 : 0666;
        fd = open(path, O_WRONLY | O_TRUNC | O_CREAT, mode);
        if (fd < 0) {
                if (errno == ENOENT) {
@@ -62,8 +62,6 @@ static int create_file(const char *path, unsigned int mode)
                        fd = open(path, O_WRONLY | O_TRUNC | O_CREAT, mode);
                }
        }
-       if (fd >= 0)
-               fchmod(fd, mode);
        return fd;
 }