Skip to content

Commit

Permalink
link_temp_to_file: don't leave the path truncated on adjust_shared_pe…
Browse files Browse the repository at this point in the history
…rm failure

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Oct 31, 2006
1 parent 9dad9d2 commit 91c23e4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sha1_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 91c23e4

Please sign in to comment.