1
0
mirror of https://github.com/git/git.git synced 2024-09-23 08:21:16 +02:00

link_temp_to_file: don't leave the path truncated on adjust_shared_perm failure

Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Junio C Hamano 2006-10-31 15:56:58 -08:00
parent 9dad9d2e5b
commit 91c23e48d0

View File

@ -1383,8 +1383,10 @@ static int link_temp_to_file(const char *tmpfile, const char *filename)
if (dir) {
*dir = 0;
mkdir(filename, 0777);
if (adjust_shared_perm(filename))
if (adjust_shared_perm(filename)) {
*dir = '/';
return -2;
}
*dir = '/';
if (!link(tmpfile, filename))
return 0;