{"thread":{"id":"1123","subject":"[PATCH] Let umask do its work upon filesystem object creation.","startedAt":"2005-07-06T08:21:46Z","lastAt":"2005-07-06T08:21:46Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"5702","messageId":"7v3bqsxs2t.fsf@assigned-by-dhcp.cox.net","threadId":"1123","inReplyTo":null,"subject":"[PATCH] Let umask do its work upon filesystem object creation.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-07-06T08:21:46Z","receivedAt":"2005-07-06T08:21:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"IIRC our strategy was to let the users' umask take care of the\nfinal mode bits.  This patch fixes places that deviate from it.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n apply.c        |    2 +-\n csum-file.c    |    2 +-\n entry.c        |    4 ++--\n init-db.c      |    2 +-\n receive-pack.c |    2 +-\n 5 files changed, 6 insertions(+), 6 deletions(-)\n\nccb441ce2e7be11fcab19f385332c530bff132f0\ndiff --git a/apply.c b/apply.c\n--- a/apply.c\n+++ b/apply.c\n@@ -1237,7 +1237,7 @@ static void create_subdirectories(const \n \t\tlen = slash - path;\n \t\tmemcpy(buf, path, len);\n \t\tbuf[len] = 0;\n-\t\tif (mkdir(buf, 0755) < 0) {\n+\t\tif (mkdir(buf, 0777) < 0) {\n \t\t\tif (errno != EEXIST)\n \t\t\t\tbreak;\n \t\t}\ndiff --git a/csum-file.c b/csum-file.c\n--- a/csum-file.c\n+++ b/csum-file.c\n@@ -86,7 +86,7 @@ struct sha1file *sha1create(const char *\n \t\tdie(\"you wascally wabbit, you\");\n \tf->namelen = len;\n \n-\tfd = open(f->name, O_CREAT | O_EXCL | O_WRONLY, 0644);\n+\tfd = open(f->name, O_CREAT | O_EXCL | O_WRONLY, 0666);\n \tif (fd < 0)\n \t\tdie(\"unable to open %s (%s)\", f->name, strerror(errno));\n \tf->fd = fd;\ndiff --git a/entry.c b/entry.c\n--- a/entry.c\n+++ b/entry.c\n@@ -12,10 +12,10 @@ static void create_directories(const cha\n \t\tlen = slash - path;\n \t\tmemcpy(buf, path, len);\n \t\tbuf[len] = 0;\n-\t\tif (mkdir(buf, 0755)) {\n+\t\tif (mkdir(buf, 0777)) {\n \t\t\tif (errno == EEXIST) {\n \t\t\t\tstruct stat st;\n-\t\t\t\tif (len > state->base_dir_len && state->force && !unlink(buf) && !mkdir(buf, 0755))\n+\t\t\t\tif (len > state->base_dir_len && state->force && !unlink(buf) && !mkdir(buf, 0777))\n \t\t\t\t\tcontinue;\n \t\t\t\tif (!stat(buf, &st) && S_ISDIR(st.st_mode))\n \t\t\t\t\tcontinue; /* ok */\ndiff --git a/init-db.c b/init-db.c\n--- a/init-db.c\n+++ b/init-db.c\n@@ -7,7 +7,7 @@\n \n static void safe_create_dir(const char *dir)\n {\n-\tif (mkdir(dir, 0755) < 0) {\n+\tif (mkdir(dir, 0777) < 0) {\n \t\tif (errno != EEXIST) {\n \t\t\tperror(dir);\n \t\t\texit(1);\ndiff --git a/receive-pack.c b/receive-pack.c\n--- a/receive-pack.c\n+++ b/receive-pack.c\n@@ -70,7 +70,7 @@ static void update(const char *name, uns\n \tif (!has_sha1_file(new_sha1))\n \t\tdie(\"unpack should have generated %s, but I can't find it!\", new_hex);\n \n-\tnewfd = open(lock_name, O_CREAT | O_EXCL | O_WRONLY, 0644);\n+\tnewfd = open(lock_name, O_CREAT | O_EXCL | O_WRONLY, 0666);\n \tif (newfd < 0)\n \t\tdie(\"unable to create %s (%s)\", lock_name, strerror(errno));\n \n"}]}