From: Junio C Hamano Date: Tue, 31 Oct 2006 23:56:58 +0000 (-0800) Subject: link_temp_to_file: don't leave the path truncated on adjust_shared_perm failure X-Git-Tag: v1.4.3.4~8 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=91c23e48d0666a673dd14760bb00f6d59234d9d9;p=git.git link_temp_to_file: don't leave the path truncated on adjust_shared_perm failure Signed-off-by: Junio C Hamano --- diff --git a/sha1_file.c b/sha1_file.c index 47e2a29ab..5fcad2893 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -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;