diff options
| author | René Scharfe <l.s.r@web.de> | 2025-11-17 20:42:55 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-11-17 13:53:09 -0800 |
| commit | f18aa68861538e93421699aa366d6691a85258b6 (patch) | |
| tree | de0ebf2037526b747462e237d03a0fe9231c4429 /wrapper.c | |
| parent | f368df439b31b422169975cc3c95f7db6a46eada (diff) | |
| download | git-f18aa68861538e93421699aa366d6691a85258b6.tar.xz | |
wrapper: simplify xmkstemp()
Call xmkstemp_mode() instead of duplicating its error handling code.
This switches the implementation from the system's mkstemp(3) to our own
git_mkstemp_mode(), which works just as well.
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wrapper.c')
| -rw-r--r-- | wrapper.c | 19 |
1 files changed, 1 insertions, 18 deletions
@@ -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. */ |
