From fa06d442c6c5113fcff9991f349157bdb0c4b989 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 17 Apr 2005 09:55:36 -0700 Subject: [PATCH] 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. --- checkout-cache.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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; } -- 2.30.2