mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 14:37:45 +00:00
[CRT]
* Update tmpfile(). CORE-8080 svn path=/trunk/; revision=63251
This commit is contained in:
parent
233ba85cfe
commit
e444ff08e2
|
@ -3346,16 +3346,20 @@ FILE* CDECL tmpfile(void)
|
||||||
FILE* file = NULL;
|
FILE* file = NULL;
|
||||||
|
|
||||||
LOCK_FILES();
|
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 (fd != -1 && (file = alloc_fp()))
|
||||||
{
|
{
|
||||||
if (init_fp(file, fd, _O_RDWR) == -1)
|
if (init_fp(file, fd, _IORW) == -1)
|
||||||
{
|
{
|
||||||
file->_flag = 0;
|
file->_flag = 0;
|
||||||
file = NULL;
|
file = NULL;
|
||||||
}
|
}
|
||||||
else file->_tmpfname = _strdup(filename);
|
else file->_tmpfname = _strdup(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(fd != -1 && !file)
|
||||||
|
_close(fd);
|
||||||
UNLOCK_FILES();
|
UNLOCK_FILES();
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue