link_temp_to_file: call adjust_shared_perm() only when we created the directory

This commit is contained in:
Johannes Schindelin 2006-11-02 18:02:17 -08:00 committed by Junio C Hamano
parent e23ed9a8b4
commit 866cae0db4

View File

@ -1382,8 +1382,7 @@ 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;
}