aboutsummaryrefslogtreecommitdiffstats
path: root/checkout-cache.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-17 09:55:36 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-17 09:55:36 -0700
commitfa06d442c6c5113fcff9991f349157bdb0c4b989 (patch)
treeaadcae71d6f2b24b78822cc077c012febee593ea /checkout-cache.c
parentc4e3cca1f71d34e69bdbfa0de0144ddb00f75505 (diff)
downloadgit-fa06d442c6c5113fcff9991f349157bdb0c4b989.tar.gz
Fix total permission bogosity in "checkout-cache.c".
Use the proper octal mode naming instead of random decimal crud, and don't reset the mode after the create with fchmod: the whole point was to let "umask" do its thing. Duh.
Diffstat (limited to 'checkout-cache.c')
-rw-r--r--checkout-cache.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/checkout-cache.c b/checkout-cache.c
index 09b36b9c77..b909f5d9a0 100644
--- a/checkout-cache.c
+++ b/checkout-cache.c
@@ -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;
}