From: Linus Torvalds Date: Sun, 17 Apr 2005 16:55:36 +0000 (-0700) Subject: Fix total permission bogosity in "checkout-cache.c". X-Git-Tag: v0.99~853 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=fa06d442c6c5113fcff9991f349157bdb0c4b989;p=git.git 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. --- diff --git a/checkout-cache.c b/checkout-cache.c index 09b36b9c7..b909f5d9a 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; }