X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=platform%2Fposix%2Ffunctions%2F_PDCLIB%2F_PDCLIB_stdinit.c;h=0e562c6a6df8db48f1075fd749f0abf2f05b14ce;hp=7d246795343005361247e6805a584d28b4b1614b;hb=fa53a74861e1ac9513ae57b7bd7889b85ac0fbe9;hpb=6e6c4e6b52f2516e4bb6b9f37c1e2e18cb7448b5 diff --git a/platform/posix/functions/_PDCLIB/_PDCLIB_stdinit.c b/platform/posix/functions/_PDCLIB/_PDCLIB_stdinit.c index 7d24679..0e562c6 100644 --- a/platform/posix/functions/_PDCLIB/_PDCLIB_stdinit.c +++ b/platform/posix/functions/_PDCLIB/_PDCLIB_stdinit.c @@ -18,6 +18,7 @@ #ifndef REGTEST #include <_PDCLIB_io.h> #include <_PDCLIB_locale.h> +#include <_PDCLIB_clocale.h> #include /* In a POSIX system, stdin / stdout / stderr are equivalent to the (int) file @@ -79,14 +80,6 @@ FILE * stdout = &_PDCLIB_sout; FILE * stderr = &_PDCLIB_serr; tss_t _PDCLIB_locale_tss; -/* Todo: Better solution than this! */ -__attribute__((constructor)) void init_stdio(void) -{ - tss_create(&_PDCLIB_locale_tss, (tss_dtor_t) freelocale); - mtx_init(&stdin->lock, mtx_recursive); - mtx_init(&stdout->lock, mtx_recursive); - mtx_init(&stderr->lock, mtx_recursive); -} /* FIXME: This approach is a possible attack vector. */ FILE * _PDCLIB_filelist = &_PDCLIB_sin; @@ -394,6 +387,16 @@ struct _PDCLIB_locale _PDCLIB_global_locale = { }, }; +/* Todo: Better solution than this! */ +__attribute__((constructor)) void init_stdio(void) +{ + _PDCLIB_initclocale( &_PDCLIB_global_locale ); + tss_create(&_PDCLIB_locale_tss, (tss_dtor_t) freelocale); + mtx_init(&stdin->lock, mtx_recursive); + mtx_init(&stdout->lock, mtx_recursive); + mtx_init(&stderr->lock, mtx_recursive); +} + #endif #ifdef TEST