diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2012-02-11 23:12:02 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2012-02-11 23:12:02 +0000 |
commit | 6ba9da3c0c15cfa2410282373c844eca4d2f3daa (patch) | |
tree | ee6b176f22f153e34bcdb99a820fa7ebec74e8fa /lib/pmfileio.c | |
parent | a09ba27efb46ed72b2f60d24fac2ff2dac7b3c13 (diff) | |
download | netpbm-mirror-6ba9da3c0c15cfa2410282373c844eca4d2f3daa.tar.gz netpbm-mirror-6ba9da3c0c15cfa2410282373c844eca4d2f3daa.tar.xz netpbm-mirror-6ba9da3c0c15cfa2410282373c844eca4d2f3daa.zip |
Fix open flags for Windows mkstempx()
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1634 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'lib/pmfileio.c')
-rw-r--r-- | lib/pmfileio.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/pmfileio.c b/lib/pmfileio.c index c9a34533..585388c2 100644 --- a/lib/pmfileio.c +++ b/lib/pmfileio.c @@ -113,6 +113,31 @@ tmpDir(void) { static int +tempFileOpenFlags(void) { +/*---------------------------------------------------------------------------- + Open flags (argument to open()) suitable for a new temporary file +-----------------------------------------------------------------------------*/ + int retval; + + retval = 0 + | O_CREAT + | O_RDWR +#ifndef WIN32 + O_EXCL +#endif +#ifdef WIN32 + O_BINARY +#endif + ; + + return retval; +} +, S_IRUSR | S_IWUSR + + + + +static int mkstempx(char * const filenameBuffer) { /*---------------------------------------------------------------------------- This is meant to be equivalent to POSIX mkstemp(). @@ -146,7 +171,8 @@ mkstempx(char * const filenameBuffer) { else { int rc; - rc = open(filenameBuffer, O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); + rc = open(filenameBuffer, tempFileOpenFlags(), + PM_S_IWUSR | PM_S_IRUSR); if (rc >= 0) { fd = rc; |