git: 589daa05be6f - stable/13 - Revert "libc/locale: Fix races between localeconv(3) and setlocale(3)"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 20 Oct 2021 01:14:30 UTC
The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=589daa05be6f390bed6fdeb820c47f8db114c5ec commit 589daa05be6f390bed6fdeb820c47f8db114c5ec Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2021-10-20 01:13:12 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2021-10-20 01:13:12 +0000 Revert "libc/locale: Fix races between localeconv(3) and setlocale(3)" This reverts commit f89204d6b99d11aa1f67722e8c1d33b0fc4d61d7. I didn't intend to push this commit yet, pending discussion on PR 258360. PR: 258360 --- lib/libc/locale/lmonetary.c | 4 ++-- lib/libc/locale/lnumeric.c | 4 ++-- lib/libc/locale/localeconv.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/libc/locale/lmonetary.c b/lib/libc/locale/lmonetary.c index b8b4e78c060b..99800ae69922 100644 --- a/lib/libc/locale/lmonetary.c +++ b/lib/libc/locale/lmonetary.c @@ -107,6 +107,8 @@ monetary_load_locale_l(struct xlocale_monetary *loc, int *using_locale, &loc->buffer, "LC_MONETARY", LCMONETARY_SIZE_FULL, LCMONETARY_SIZE_MIN, (const char **)l); + if (ret != _LDP_ERROR) + *changed = 1; if (ret == _LDP_LOADED) { l->mon_grouping = __fix_locale_grouping_str(l->mon_grouping); @@ -144,8 +146,6 @@ monetary_load_locale_l(struct xlocale_monetary *loc, int *using_locale, M_ASSIGN_ICHAR(p_sign_posn); M_ASSIGN_ICHAR(n_sign_posn); } - if (ret != _LDP_ERROR) - atomic_store_rel_int(changed, 1); return (ret); } int diff --git a/lib/libc/locale/lnumeric.c b/lib/libc/locale/lnumeric.c index cc1daa3863e3..046d1f1817dc 100644 --- a/lib/libc/locale/lnumeric.c +++ b/lib/libc/locale/lnumeric.c @@ -73,6 +73,8 @@ numeric_load_locale(struct xlocale_numeric *loc, int *using_locale, int *changed &loc->buffer, "LC_NUMERIC", LCNUMERIC_SIZE, LCNUMERIC_SIZE, (const char**)l); + if (ret != _LDP_ERROR) + *changed= 1; if (ret == _LDP_LOADED) { /* Can't be empty according to C99 */ if (*l->decimal_point == '\0') @@ -81,8 +83,6 @@ numeric_load_locale(struct xlocale_numeric *loc, int *using_locale, int *changed l->grouping = __fix_locale_grouping_str(l->grouping); } - if (ret != _LDP_ERROR) - atomic_store_rel_int(changed, 1); return (ret); } diff --git a/lib/libc/locale/localeconv.c b/lib/libc/locale/localeconv.c index 130f93c178f4..641773944e32 100644 --- a/lib/libc/locale/localeconv.c +++ b/lib/libc/locale/localeconv.c @@ -65,7 +65,7 @@ localeconv_l(locale_t loc) FIX_LOCALE(loc); struct lconv *ret = &loc->lconv; - if (atomic_load_acq_int(&loc->monetary_locale_changed) != 0) { + if (loc->monetary_locale_changed) { /* LC_MONETARY part */ struct lc_monetary_T * mptr; @@ -94,10 +94,10 @@ localeconv_l(locale_t loc) M_ASSIGN_CHAR(int_n_sep_by_space); M_ASSIGN_CHAR(int_p_sign_posn); M_ASSIGN_CHAR(int_n_sign_posn); - atomic_store_int(&loc->monetary_locale_changed, 0); + loc->monetary_locale_changed = 0; } - if (atomic_load_acq_int(&loc->numeric_locale_changed) != 0) { + if (loc->numeric_locale_changed) { /* LC_NUMERIC part */ struct lc_numeric_T * nptr; @@ -107,7 +107,7 @@ localeconv_l(locale_t loc) N_ASSIGN_STR(decimal_point); N_ASSIGN_STR(thousands_sep); N_ASSIGN_STR(grouping); - atomic_store_int(&loc->numeric_locale_changed, 0); + loc->numeric_locale_changed = 0; } return ret;