mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
xlocale.c:init_key(): do not ignore errors from pthread_key_create()
Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D34140
This commit is contained in:
parent
aaa6fa65a6
commit
fcdf9d7de5
1 changed files with 9 additions and 4 deletions
|
|
@ -117,11 +117,16 @@ static locale_t thread_local_locale;
|
|||
static void
|
||||
init_key(void)
|
||||
{
|
||||
int error;
|
||||
|
||||
pthread_key_create(&locale_info_key, xlocale_release);
|
||||
pthread_setspecific(locale_info_key, (void*)42);
|
||||
if (pthread_getspecific(locale_info_key) == (void*)42) {
|
||||
pthread_setspecific(locale_info_key, 0);
|
||||
error = pthread_key_create(&locale_info_key, xlocale_release);
|
||||
if (error == 0) {
|
||||
pthread_setspecific(locale_info_key, (void*)42);
|
||||
if (pthread_getspecific(locale_info_key) == (void*)42) {
|
||||
pthread_setspecific(locale_info_key, 0);
|
||||
} else {
|
||||
fake_tls = 1;
|
||||
}
|
||||
} else {
|
||||
fake_tls = 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue