windows compatibility; suggested by github.com/sapien2

This commit is contained in:
Lev Walkin 2013-03-16 08:00:57 -07:00
parent 0afe0735d4
commit 50d52cf5fd
1 changed files with 11 additions and 0 deletions

View File

@ -13,6 +13,17 @@
#endif
#endif
#ifdef _WIN32
int mkstemp(char *template) {
char *tmpFN = _mktemp(template);
if(tmpFN)
return open(tmpFN, O_CREAT | O_EXCL | O_WRONLY, DEFFILEMODE);
else
return -1;
}
#undef HAVE_MKSTEMPS
#endif
#ifdef HAVE_MKSTEMPS
#undef mkstemp
#define mkstemp(foo) mkstemps(foo, 0)