summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2025-12-06 14:27:47 +0100
committerJunio C Hamano <gitster@pobox.com>2025-12-07 07:28:12 +0900
commit5ecd3590a3052820eeb3f1d6764584c537b68938 (patch)
treec7dde0d40f36956b3c643d95dc28f362300ed490
parente1ecf0dd6897eae1594b7e9345605b8f88485b95 (diff)
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>
-rw-r--r--compat/mkdtemp.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/compat/mkdtemp.c b/compat/mkdtemp.c
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);
}