summaryrefslogtreecommitdiff
path: root/builtin-pack-objects.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-04-22 11:49:35 -0700
committerJunio C Hamano <junkio@cox.net>2007-04-22 11:49:35 -0700
commitaef5aedd8536fddbbd2e19245dfab201d05afb25 (patch)
tree8b2af3a318d4f8181ba44e2fd81edb9c8c6b9074 /builtin-pack-objects.c
parent4629795816bf3f58a02872ec389a92de7efd38c4 (diff)
downloadgit-aef5aedd8536fddbbd2e19245dfab201d05afb25.tar.gz
pack-objects: quickfix for permission modes.
mkstemp() often creates the file in 0600 which means the resulting packfile is not readable by anybody other than the repository owner. Force 0644 for now, even though this is not strictly correct. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-pack-objects.c')
-rw-r--r--builtin-pack-objects.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index c72e07a2bb..840d4d697a 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -1783,11 +1783,17 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
write_index_file(last_obj_offset, object_list_sha1);
snprintf(tmpname, sizeof(tmpname), "%s-%s.pack",
base_name, sha1_to_hex(object_list_sha1));
+ if (chmod(pack_tmp_name, 0644))
+ die("unable to make temporary pack file readable: %s",
+ strerror(errno));
if (rename(pack_tmp_name, tmpname))
die("unable to rename temporary pack file: %s",
strerror(errno));
snprintf(tmpname, sizeof(tmpname), "%s-%s.idx",
base_name, sha1_to_hex(object_list_sha1));
+ if (chmod(idx_tmp_name, 0644))
+ die("unable to make temporary index file readable: %s",
+ strerror(errno));
if (rename(idx_tmp_name, tmpname))
die("unable to rename temporary index file: %s",
strerror(errno));