Commits

Junio C Hamano  committed 91c23e4

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

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

  • Participants
  • Parent commits 9dad9d2

Comments (0)

Files changed (1)

 	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;