@matheusbsbs / matheus-bagliano / commits / 91c23e48d0
Fork 0

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

Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Oct 31, 2006 at 15:56 UTC 91c23e48d0666a673dd14760bb00f6d59234d9d9
1 file changed +3 -1
sha1_file.c
+3 -1
@@ -1383,8 +1383,10 @@ static int link_temp_to_file(const char *tmpfile, const char *filename)
1383 if (dir) {
1384 *dir = 0;
1385 mkdir(filename, 0777);
1386 - if (adjust_shared_perm(filename))
1386 + if (adjust_shared_perm(filename)) {
1387 + *dir = '/';
1388 return -2;
1389 + }
1390 *dir = '/';
1391 if (!link(tmpfile, filename))
1392 return 0;