FreeBSD Bugzilla – Attachment 227762 Details for
Bug 258360
race between setlocale() and iconv_open() causes segfault
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
diff (text/plain), 2.59 KB, created by
Mark Johnston
on 2021-09-08 13:39:18 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Mark Johnston
Created:
2021-09-08 13:39:18 UTC
Size:
2.59 KB
patch
obsolete
>diff --git a/lib/libc/locale/lmonetary.c b/lib/libc/locale/lmonetary.c >index 99800ae69922..b8b4e78c060b 100644 >--- a/lib/libc/locale/lmonetary.c >+++ b/lib/libc/locale/lmonetary.c >@@ -107,8 +107,6 @@ 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); >@@ -146,6 +144,8 @@ 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 046d1f1817dc..cc1daa3863e3 100644 >--- a/lib/libc/locale/lnumeric.c >+++ b/lib/libc/locale/lnumeric.c >@@ -73,8 +73,6 @@ 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') >@@ -83,6 +81,8 @@ 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 641773944e32..130f93c178f4 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 (loc->monetary_locale_changed) { >+ if (atomic_load_acq_int(&loc->monetary_locale_changed) != 0) { > /* 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); >- loc->monetary_locale_changed = 0; >+ atomic_store_int(&loc->monetary_locale_changed, 0); > } > >- if (loc->numeric_locale_changed) { >+ if (atomic_load_acq_int(&loc->numeric_locale_changed) != 0) { > /* 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); >- loc->numeric_locale_changed = 0; >+ atomic_store_int(&loc->numeric_locale_changed, 0); > } > > return ret;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 258360
: 227762