aboutsummaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-10-31 15:56:58 -0800
committerJunio C Hamano <junkio@cox.net>2006-10-31 15:56:58 -0800
commit91c23e48d0666a673dd14760bb00f6d59234d9d9 (patch)
treef32f8e3ab65c369a41fda0f0ec8a89f4997f9da6 /sha1_file.c
parent9dad9d2e5b322835c87e1653268d892a95ee0f1f (diff)
downloadgit-91c23e48d0666a673dd14760bb00f6d59234d9d9.tar.gz
git-91c23e48d0666a673dd14760bb00f6d59234d9d9.tar.xz
link_temp_to_file: don't leave the path truncated on adjust_shared_perm failure
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c4
1 files changed, 3 insertions, 1 deletions
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;