Author: akhaldi
Date: Mon May 12 12:50:55 2014
New Revision: 63251
URL:
http://svn.reactos.org/svn/reactos?rev=63251&view=rev
Log:
[CRT]
* Update tmpfile().
CORE-8080
Modified:
trunk/reactos/lib/sdk/crt/stdio/file.c
Modified: trunk/reactos/lib/sdk/crt/stdio/file.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdio/file.c?r…
==============================================================================
--- trunk/reactos/lib/sdk/crt/stdio/file.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/stdio/file.c [iso-8859-1] Mon May 12 12:50:55 2014
@@ -3346,16 +3346,20 @@
FILE* file = NULL;
LOCK_FILES();
- fd = _open(filename, _O_CREAT | _O_BINARY | _O_RDWR | _O_TEMPORARY);
+ fd = _open(filename, _O_CREAT | _O_BINARY | _O_RDWR | _O_TEMPORARY,
+ _S_IREAD | _S_IWRITE);
if (fd != -1 && (file = alloc_fp()))
{
- if (init_fp(file, fd, _O_RDWR) == -1)
+ if (init_fp(file, fd, _IORW) == -1)
{
file->_flag = 0;
file = NULL;
}
else file->_tmpfname = _strdup(filename);
}
+
+ if(fd != -1 && !file)
+ _close(fd);
UNLOCK_FILES();
return file;
}