* Update _mktemp().
* Fixes some msvcrt tests.
CORE-8080

svn path=/trunk/; revision=63233
This commit is contained in:
Amine Khaldi 2014-05-11 16:47:56 +00:00
parent 5da6e57577
commit 330869f298

View file

@ -1403,9 +1403,12 @@ char * CDECL _mktemp(char *pattern)
int id; int id;
char letter = 'a'; char letter = 'a';
if(!pattern)
return NULL;
while(*pattern) while(*pattern)
numX = (*pattern++ == 'X')? numX + 1 : 0; numX = (*pattern++ == 'X')? numX + 1 : 0;
if (numX < 5) if (numX < 6)
return NULL; return NULL;
pattern--; pattern--;
id = GetCurrentProcessId(); id = GetCurrentProcessId();
@ -1420,8 +1423,7 @@ char * CDECL _mktemp(char *pattern)
do do
{ {
*pattern = letter++; *pattern = letter++;
if (GetFileAttributesA(retVal) == INVALID_FILE_ATTRIBUTES && if (GetFileAttributesA(retVal) == INVALID_FILE_ATTRIBUTES)
GetLastError() == ERROR_FILE_NOT_FOUND)
return retVal; return retVal;
} while(letter <= 'z'); } while(letter <= 'z');
return NULL; return NULL;