Skip to content

Commit 5ecd359

Browse files
rscharfegitster
authored andcommitted
compat: use git_mkdtemp()
A file might appear at the path returned by mktemp(3) before we call mkdir(2). Use the more robust git_mkdtemp() instead, which retries a number of times and doesn't need to call lstat(2). Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent e1ecf0d commit 5ecd359

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

compat/mkdtemp.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@
22

33
char *gitmkdtemp(char *template)
44
{
5-
if (!*mktemp(template) || mkdir(template, 0700))
6-
return NULL;
7-
return template;
5+
return git_mkdtemp(template);
86
}

0 commit comments

Comments
 (0)