@matheusbsbs / matheus-bagliano / commits / aef5aedd85
Fork 0

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>

Junio C Hamano committed Apr 22, 2007 at 11:49 UTC aef5aedd8536fddbbd2e19245dfab201d05afb25
1 file changed +6
builtin-pack-objects.c
+6
@@ -1783,11 +1783,17 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
1783 write_index_file(last_obj_offset, object_list_sha1);
1784 snprintf(tmpname, sizeof(tmpname), "%s-%s.pack",
1785 base_name, sha1_to_hex(object_list_sha1));
1786 + if (chmod(pack_tmp_name, 0644))
1787 + die("unable to make temporary pack file readable: %s",
1788 + strerror(errno));
1789 if (rename(pack_tmp_name, tmpname))
1790 die("unable to rename temporary pack file: %s",
1791 strerror(errno));
1792 snprintf(tmpname, sizeof(tmpname), "%s-%s.idx",
1793 base_name, sha1_to_hex(object_list_sha1));
1794 + if (chmod(idx_tmp_name, 0644))
1795 + die("unable to make temporary index file readable: %s",
1796 + strerror(errno));
1797 if (rename(idx_tmp_name, tmpname))
1798 die("unable to rename temporary index file: %s",
1799 strerror(errno));