msvcrt: Fixed tmpfile implementation.

This commit is contained in:
Piotr Caban 2012-10-16 17:23:04 +02:00 committed by Alexandre Julliard
parent 7d128ea899
commit c00702cd6e
1 changed files with 6 additions and 2 deletions

View File

@ -3754,16 +3754,20 @@ MSVCRT_FILE* CDECL MSVCRT_tmpfile(void)
MSVCRT_FILE* file = NULL;
LOCK_FILES();
fd = MSVCRT__open(filename, MSVCRT__O_CREAT | MSVCRT__O_BINARY | MSVCRT__O_RDWR | MSVCRT__O_TEMPORARY);
fd = MSVCRT__open(filename, MSVCRT__O_CREAT | MSVCRT__O_BINARY | MSVCRT__O_RDWR | MSVCRT__O_TEMPORARY,
MSVCRT__S_IREAD | MSVCRT__S_IWRITE);
if (fd != -1 && (file = msvcrt_alloc_fp()))
{
if (msvcrt_init_fp(file, fd, MSVCRT__O_RDWR) == -1)
if (msvcrt_init_fp(file, fd, MSVCRT__IORW) == -1)
{
file->_flag = 0;
file = NULL;
}
else file->_tmpfname = MSVCRT__strdup(filename);
}
if(fd != -1 && !file)
MSVCRT__close(fd);
UNLOCK_FILES();
return file;
}