1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

msvcrt: Protect setlocale against concurrent accesses.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55467
This commit is contained in:
Bernhard Übelacker 2023-12-08 16:54:45 +01:00 committed by Alexandre Julliard
parent bed2495e50
commit 3481d165d1

View file

@ -2036,6 +2036,7 @@ char* CDECL setlocale(int category, const char* locale)
{
thread_data_t *data = msvcrt_get_thread_data();
pthreadlocinfo locinfo = get_locinfo(), newlocinfo;
int locale_flags;
if(category<LC_MIN || category>LC_MAX)
return NULL;
@ -2047,7 +2048,11 @@ char* CDECL setlocale(int category, const char* locale)
return locinfo->lc_category[category].locale;
}
/* Make sure that locinfo is not updated by e.g. stricmp function */
locale_flags = data->locale_flags;
data->locale_flags |= LOCALE_THREAD;
newlocinfo = create_locinfo(category, locale, locinfo);
data->locale_flags = locale_flags;
if(!newlocinfo) {
WARN("%d %s failed\n", category, locale);
return NULL;