Test mkstemp replacement for tempfile.

This commit is contained in:
John McNamara 2015-10-04 02:17:27 +01:00
parent e4bc6eac0e
commit 211dacdfd8
2 changed files with 13 additions and 2 deletions

View file

@ -19,7 +19,7 @@ INC_DIR = ../include
MINIZIP_DIR = ../third_party/minizip
# Flags passed to compiler.
CFLAGS += -g -O3 -Wall -Wextra -pedantic -ansi
CFLAGS += -g -O3 -Wall -Wextra -pedantic
# Library names.
LIBXLSXWRITER_A = libxlsxwriter.a

View file

@ -12,6 +12,7 @@
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include "xlsxwriter/utility.h"
/*
@ -411,5 +412,15 @@ lxw_quote_sheetname(char *str)
FILE *
lxw_tmpfile(void)
{
return tmpfile();
char template[] = "/tmp/libxlsxwriter.XXXXXX";
FILE *tempfile;
int fd;
fd = mkstemp(template);
tempfile = fdopen(fd, "w+");
unlink(template);
return tempfile;
/* return tmpfile(); */
}