Skip to content

Commit b933c14

Browse files
author
Edward Thomson
committed
util: remove p_mktemp / p_mkstemp
We have our own temporary file creation function now in `git_futils_mktmp`, remove the others since they may be terrible on some platforms.
1 parent 97fade4 commit b933c14

File tree

4 files changed

+0
-17
lines changed

4 files changed

+0
-17
lines changed

src/posix.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ extern ssize_t p_pwrite(int fd, const void *data, size_t size, off64_t offset);
131131

132132
#define p_close(fd) close(fd)
133133
#define p_umask(m) umask(m)
134-
#define p_mktemp(p) mktemp(p)
135134

136135
extern int p_open(const char *path, int flags, ...);
137136
extern int p_creat(const char *path, mode_t mode);

src/unix/posix.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ GIT_INLINE(int) p_fsync(int fd)
5858
#define p_strncasecmp(s1, s2, c) strncasecmp(s1, s2, c)
5959
#define p_vsnprintf(b, c, f, a) vsnprintf(b, c, f, a)
6060
#define p_snprintf snprintf
61-
#define p_mkstemp(p) mkstemp(p)
6261
#define p_chdir(p) chdir(p)
6362
#define p_rmdir(p) rmdir(p)
6463
#define p_access(p,m) access(p,m)

src/win32/posix.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ extern int p_inet_pton(int af, const char *src, void* dst);
4242

4343
extern int p_vsnprintf(char *buffer, size_t count, const char *format, va_list argptr);
4444
extern int p_snprintf(char *buffer, size_t count, const char *format, ...) GIT_FORMAT_PRINTF(3, 4);
45-
extern int p_mkstemp(char *tmp_path);
4645
extern int p_chdir(const char *path);
4746
extern int p_chmod(const char *path, mode_t mode);
4847
extern int p_rmdir(const char *path);

src/win32/posix_w32.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -860,20 +860,6 @@ int p_snprintf(char *buffer, size_t count, const char *format, ...)
860860
return r;
861861
}
862862

863-
/* TODO: wut? */
864-
int p_mkstemp(char *tmp_path)
865-
{
866-
#if defined(_MSC_VER) && _MSC_VER >= 1500
867-
if (_mktemp_s(tmp_path, strlen(tmp_path) + 1) != 0)
868-
return -1;
869-
#else
870-
if (_mktemp(tmp_path) == NULL)
871-
return -1;
872-
#endif
873-
874-
return p_open(tmp_path, O_RDWR | O_CREAT | O_EXCL, 0744); /* -V536 */
875-
}
876-
877863
int p_access(const char *path, mode_t mode)
878864
{
879865
git_win32_path buf;

0 commit comments

Comments
 (0)