* Update tmpfile().
CORE-8080

svn path=/trunk/; revision=63251
This commit is contained in:
Amine Khaldi 2014-05-12 12:50:55 +00:00
parent 233ba85cfe
commit e444ff08e2

View file

@ -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;
} }