create_tempfile: make sure that leading directories can be accessible by peers
In a shared repository, we should make sure adjust_shared_perm() is called after creating the initial fan-out directories under objects/ directory. Earlier an logico called the function only when mkdir() failed; we should do so when mkdir() succeeded. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jun 16, 2008 at 22:02 UTC
3bfaf01857ebcefbd38529a73b059dc984ecb5a4
1 file changed
+2
-2
sha1_file.c
+2
-2
@@ -116,7 +116,7 @@ int safe_create_leading_directories(char *path)
116
return 0;
117
}
118
119
-char * sha1_to_hex(const unsigned char *sha1)
119
+char *sha1_to_hex(const unsigned char *sha1)
120
{
121
static int bufno;
122
static char hexbuffer[4][50];
@@ -2125,7 +2125,7 @@ static int create_tmpfile(char *buffer, size_t bufsiz, const char *filename)
2125
if (fd < 0 && dirlen) {
2126
/* Make sure the directory exists */
2127
buffer[dirlen-1] = 0;
2128
- if (mkdir(buffer, 0777) && adjust_shared_perm(buffer))
2128
+ if (mkdir(buffer, 0777) || adjust_shared_perm(buffer))
2129
return -1;
2130
2131
/* Try again */