On Thu, Jun 22, 2017 at 14:36:53 +0200, Martin Kletzander wrote: > Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx> > --- > src/util/virstring.c | 96 ++++++++++++++++++++++++++++++++-------------------- > 1 file changed, 60 insertions(+), 36 deletions(-) > > diff --git a/src/util/virstring.c b/src/util/virstring.c > index feea5be05198..6125725364f3 100644 > --- a/src/util/virstring.c > +++ b/src/util/virstring.c > @@ -522,6 +522,7 @@ virStrToLong_ullp(char const *s, char **end_ptr, int base, > #if HAVE_NEWLOCALE > > static locale_t virLocale; > +static locale_t virLocaleOld; This is not a thread local variable ... > > static int > virLocaleOnceInit(void) > @@ -533,7 +534,58 @@ virLocaleOnceInit(void) > } > > VIR_ONCE_GLOBAL_INIT(virLocale); > -#endif > + > +static int > +virLocaleSet(void) > +{ > + if (virLocaleInitialize() < 0) > + return -1; > + virLocaleOld = uselocale(virLocale); ... and this is called multiple times ... > + return 0; > +} > + > +static void > +virLocaleRevert(void) > +{ > + uselocale(virLocaleOld); ... so while this at this moment will behave correctly, since virLocaleOld will only be ever set to the same old locale, the general approach is not correct.
Attachment:
signature.asc
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list