Fix the build

This commit is contained in:
Justine Tunney 2023-08-13 07:17:40 -07:00
parent 6942d7b820
commit b40d41085d
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
4 changed files with 32 additions and 26 deletions

View file

@ -27,6 +27,8 @@
#define _O_TMPFILE 000020200000
int _mkstemp(char *, int);
/**
* Returns file descriptor of open anonymous file, e.g.
*
@ -88,7 +90,7 @@ int tmpfd(void) {
if (!(prog = program_invocation_short_name)) prog = "tmp";
strlcat(path, prog, sizeof(path));
strlcat(path, ".XXXXXX", sizeof(path));
if ((fd = mkstemp(path)) == -1) return -1;
if ((fd = _mkstemp(path, IsWindows() ? 0x00410000 : 0)) == -1) return -1;
if (!IsWindows()) unassert(!unlink(path));
return fd;
}