diff options
Diffstat (limited to 'sha1_file.c')
-rw-r--r-- | sha1_file.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sha1_file.c b/sha1_file.c index 5e6c8b8bbf..2aa944abd0 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; |