summaryrefslogtreecommitdiff
path: root/server-info.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-01-05 22:50:49 -0500
committerJunio C Hamano <gitster@pobox.com>2015-01-06 13:46:52 -0800
commitd91175b2128aeae00ed10cd7e8216a60ca66e06b (patch)
tree30680c19e3a591e5a3ad01eb12175529a891f8ce /server-info.c
parentd05c77cca2a6768ca03e95bcdd7358eb6af85c1a (diff)
downloadgit-d91175b2128aeae00ed10cd7e8216a60ca66e06b.tar.gz
update-server-info: create info/* with mode 0666jk/prune-packed-server-info
Prior to d38379e (make update-server-info more robust, 2014-09-13), we used a straight "fopen" to create the info/refs and objects/info/packs files, which creates the file using mode 0666 (less the default umask). In d38379e, we switched to creating the file with mkstemp to get a unique filename. But mkstemp also uses the more restrictive 0600 mode to create the file. This was an unintended side effect that we did not want, and causes problems when the repository is served by a different user than the one running update-server-info (it is not readable by a dumb http server running as `www`, for example). We can fix this by using git_mkstemp_mode and specifying 0666 to make sure that the umask is honored. Note that we could also say "just use core.sharedrepository", as we do call adjust_shared_perm on the result before renaming it into place. But that should not be necessary as long as everybody involved is using permissive umask to allow HTTP server to read necessary files. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'server-info.c')
-rw-r--r--server-info.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/server-info.c b/server-info.c
index 31f4a749fb..34b0253177 100644
--- a/server-info.c
+++ b/server-info.c
@@ -17,7 +17,7 @@ static int update_info_file(char *path, int (*generate)(FILE *))
FILE *fp = NULL;
safe_create_leading_directories(path);
- fd = mkstemp(tmp);
+ fd = git_mkstemp_mode(tmp, 0666);
if (fd < 0)
goto out;
fp = fdopen(fd, "w");