aboutsummaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 5e6c8b8bb..2aa944abd 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1417,9 +1417,10 @@ static int link_temp_to_file(const char *tmpfile, const char *filename)
dir = strrchr(filename, '/');
if (dir) {
*dir = 0;
- mkdir(filename, 0777);
- if (adjust_shared_perm(filename))
+ if (!mkdir(filename, 0777) && adjust_shared_perm(filename)) {
+ *dir = '/';
return -2;
+ }
*dir = '/';
if (!link(tmpfile, filename))
return 0;