msvcrt: Fixed tmpnam and _wtmpname implementation.

This commit is contained in:
Piotr Caban 2011-07-26 11:13:37 +02:00 committed by Alexandre Julliard
parent 9fc0377f64
commit 5e9ee3b909
2 changed files with 4 additions and 0 deletions

View File

@ -3683,6 +3683,7 @@ char * CDECL MSVCRT_tmpnam(char *s)
{
size = msvcrt_int_to_base32(tmpnam_unique++, tmpstr);
memcpy(p, tmpstr, size);
p[size] = '\0';
if (GetFileAttributesA(s) == INVALID_FILE_ATTRIBUTES &&
GetLastError() == ERROR_FILE_NOT_FOUND)
break;
@ -3714,6 +3715,7 @@ MSVCRT_wchar_t * CDECL MSVCRT_wtmpnam(MSVCRT_wchar_t *s)
{
size = msvcrt_int_to_base32_w(tmpnam_unique++, tmpstr);
memcpy(p, tmpstr, size*sizeof(MSVCRT_wchar_t));
p[size] = '\0';
if (GetFileAttributesW(s) == INVALID_FILE_ATTRIBUTES &&
GetLastError() == ERROR_FILE_NOT_FOUND)
break;

View File

@ -74,6 +74,8 @@ static inline void msvcrt_free_tls_mem(void)
HeapFree(GetProcessHeap(),0,tls->strerror_buffer);
HeapFree(GetProcessHeap(),0,tls->wcserror_buffer);
HeapFree(GetProcessHeap(),0,tls->time_buffer);
HeapFree(GetProcessHeap(),0,tls->tmpnam_buffer);
HeapFree(GetProcessHeap(),0,tls->wtmpnam_buffer);
if(tls->have_locale) {
free_locinfo(tls->locinfo);
free_mbcinfo(tls->mbcinfo);