aboutsummaryrefslogtreecommitdiff
path: root/wrapper.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-11-26 10:32:40 -0800
committerJunio C Hamano <gitster@pobox.com>2025-11-26 10:32:40 -0800
commit370470e240b5c855af32f7123de3f1e612b0d2b7 (patch)
treec6c2b716f2e76e23c45181773643f32cbdefaafb /wrapper.c
parent1b93acd13a18e8a08c8255fa193b62ed53f29ee7 (diff)
parentf18aa68861538e93421699aa366d6691a85258b6 (diff)
downloadgit-370470e240b5c855af32f7123de3f1e612b0d2b7.tar.xz
Merge branch 'rs/xmkstemp-simplify'
Code simplification. * rs/xmkstemp-simplify: wrapper: simplify xmkstemp()
Diffstat (limited to 'wrapper.c')
-rw-r--r--wrapper.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/wrapper.c b/wrapper.c
index 3d507d4204..d5976b3e7e 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -421,24 +421,7 @@ FILE *fopen_or_warn(const char *path, const char *mode)
int xmkstemp(char *filename_template)
{
- int fd;
- char origtemplate[PATH_MAX];
- strlcpy(origtemplate, filename_template, sizeof(origtemplate));
-
- fd = mkstemp(filename_template);
- if (fd < 0) {
- int saved_errno = errno;
- const char *nonrelative_template;
-
- if (strlen(filename_template) != strlen(origtemplate))
- filename_template = origtemplate;
-
- nonrelative_template = absolute_path(filename_template);
- errno = saved_errno;
- die_errno("Unable to create temporary file '%s'",
- nonrelative_template);
- }
- return fd;
+ return xmkstemp_mode(filename_template, 0600);
}
/* Adapted from libiberty's mkstemp.c. */