summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: aef5aed)
raw | patch | inline | side by side (parent: aef5aed)
author | Junio C Hamano <junkio@cox.net> | |
Sun, 22 Apr 2007 19:28:34 +0000 (12:28 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 22 Apr 2007 19:28:34 +0000 (12:28 -0700) |
The earlier quickfix forced world-readable permission bits. This
updates it to honor umask and core.sharedrepository settings.
Signed-off-by: Junio C Hamano <junkio@cox.net>
updates it to honor umask and core.sharedrepository settings.
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-pack-objects.c | patch | blob | history |
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 840d4d697a74901599bf9d9222375811c6a0e668..34350bf322458da33adde0bbb6d96628c8f279f5 100644 (file)
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
traverse_commit_list(&revs, show_commit, show_object);
}
+static int adjust_perm(const char *path, mode_t mode)
+{
+ if (chmod(path, mode))
+ return -1;
+ return adjust_shared_perm(path);
+}
+
int cmd_pack_objects(int argc, const char **argv, const char *prefix)
{
int depth = 10;
last_obj_offset = write_pack_file();
if (!pack_to_stdout) {
unsigned char object_list_sha1[20];
+ mode_t mode = umask(0);
+
+ umask(mode);
+ mode = 0666 & ~mode;
+
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))
+ if (adjust_perm(pack_tmp_name, mode))
die("unable to make temporary pack file readable: %s",
strerror(errno));
if (rename(pack_tmp_name, tmpname))
strerror(errno));
snprintf(tmpname, sizeof(tmpname), "%s-%s.idx",
base_name, sha1_to_hex(object_list_sha1));
- if (chmod(idx_tmp_name, 0644))
+ if (adjust_perm(idx_tmp_name, mode))
die("unable to make temporary index file readable: %s",
strerror(errno));
if (rename(idx_tmp_name, tmpname))