Skip to content

Commit

Permalink
pack-objects: quickfix for permission modes.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Apr 22, 2007
1 parent 4629795 commit aef5aed
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions builtin-pack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit aef5aed

Please sign in to comment.