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>
René Scharfe committed
Dec 6, 2025 at 14:27 UTC
5ecd3590a3052820eeb3f1d6764584c537b68938
1 file changed
+1
-3
compat/mkdtemp.c
+1
-3
index 1136119592..fcdd4e01e1 100644
--- a/compat/mkdtemp.c
+++ b/compat/mkdtemp.c
@@ -2,7 +2,5 @@
char *gitmkdtemp(char *template)
{
- if (!*mktemp(template) || mkdir(template, 0700))
- return NULL;
- return template;
+ return git_mkdtemp(template);
}