diff --git a/src/tmpfileplus.c b/src/tmpfileplus.c index 9af0260b38..ddb71de092 100644 --- a/src/tmpfileplus.c +++ b/src/tmpfileplus.c @@ -200,13 +200,13 @@ static FILE *mktempfile_internal(const char *tmpdir, const char *pfx, char **tmp */ #ifdef _WIN32 /* MSVC flags */ - oflag = _O_BINARY|_O_CREAT|_O_EXCL|_O_RDWR; + oflag = _O_BINARY|_O_CREAT|_O_RDWR; if (!keep) oflag |= _O_TEMPORARY; pmode = _S_IREAD | _S_IWRITE; #else /* Standard POSIX flags */ - oflag = O_CREAT|O_EXCL|O_RDWR; + oflag = O_CREAT|O_RDWR; pmode = S_IRUSR|S_IWUSR; #endif @@ -239,7 +239,7 @@ static FILE *mktempfile_internal(const char *tmpdir, const char *pfx, char **tmp #ifndef _WIN32 /* [Unix only] And make sure the file will be deleted once closed */ - if (!keep) unlink(tmpname); + if (!keep) remove(tmpname); #endif } diff --git a/src/tmpfileplus.h b/src/tmpfileplus.h index 6c6ac38a75..e32ff5042d 100644 --- a/src/tmpfileplus.h +++ b/src/tmpfileplus.h @@ -23,6 +23,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + /** Create a unique temporary file. @param dir (optional) directory to create file. If NULL use default TMP directory. @param prefix (optional) prefix for file name. If NULL use "tmp.". @@ -50,4 +54,8 @@ FILE *tmpfileplus_f(const char *dir, const char *prefix, char *pathnamebuf, size #define TMPFILE_KEEP 1 +#ifdef __cplusplus +} +#endif + #endif /* end TMPFILEPLUS_H_ */