summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sha1_file.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 06784fb95a..68ccb048ac 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2787,7 +2787,9 @@ static int create_tmpfile(char *buffer, size_t bufsiz, const char *filename)
/* Make sure the directory exists */
memcpy(buffer, filename, dirlen);
buffer[dirlen-1] = 0;
- if (mkdir(buffer, 0777) || adjust_shared_perm(buffer))
+ if (mkdir(buffer, 0777) && errno != EEXIST)
+ return -1;
+ if (adjust_shared_perm(buffer))
return -1;
/* Try again */