Skip to content
This repository was archived by the owner on Jul 2, 2019. It is now read-only.

Commit 91c23e4

Browse files
author
Junio C Hamano
committed
link_temp_to_file: don't leave the path truncated on adjust_shared_perm failure
Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9dad9d2 commit 91c23e4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sha1_file.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,8 +1383,10 @@ static int link_temp_to_file(const char *tmpfile, const char *filename)
13831383
if (dir) {
13841384
*dir = 0;
13851385
mkdir(filename, 0777);
1386-
if (adjust_shared_perm(filename))
1386+
if (adjust_shared_perm(filename)) {
1387+
*dir = '/';
13871388
return -2;
1389+
}
13881390
*dir = '/';
13891391
if (!link(tmpfile, filename))
13901392
return 0;

0 commit comments

Comments
 (0)