diff options
author | 2013-05-03 13:53:49 +0000 | |
---|---|---|
committer | 2013-05-03 13:53:49 +0000 | |
commit | 38b585658e97e144c38f63b0253c94ec5fd00f51 (patch) | |
tree | 03dcc1d7eedf7c8031dd133236ba54e0f5f74a57 /lib/libc | |
parent | Document which gobal variables are used for sysctl(8), add static to (diff) | |
download | wireguard-openbsd-38b585658e97e144c38f63b0253c94ec5fd00f51.tar.xz wireguard-openbsd-38b585658e97e144c38f63b0253c94ec5fd00f51.zip |
Fix resetting MB_CUR_MAX when switching locales away from a UTF-8 locale.
Patch by Vladimir Támara Patiño <vtamara@pasosdeJesus.org>
ok mpi millert
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/citrus/citrus_ctype.c | 6 | ||||
-rw-r--r-- | lib/libc/citrus/citrus_ctype_local.h | 3 | ||||
-rw-r--r-- | lib/libc/locale/setrunelocale.c | 3 |
3 files changed, 7 insertions, 5 deletions
diff --git a/lib/libc/citrus/citrus_ctype.c b/lib/libc/citrus/citrus_ctype.c index 129e10b37f2..cb187c5e9a1 100644 --- a/lib/libc/citrus/citrus_ctype.c +++ b/lib/libc/citrus/citrus_ctype.c @@ -1,4 +1,4 @@ -/* $OpenBSD: citrus_ctype.c,v 1.3 2012/12/05 23:19:59 deraadt Exp $ */ +/* $OpenBSD: citrus_ctype.c,v 1.4 2013/05/03 13:53:49 stsp Exp $ */ /* $NetBSD: citrus_ctype.c,v 1.5 2008/06/14 16:01:07 tnozaki Exp $ */ /*- @@ -38,10 +38,12 @@ struct _citrus_ctype_rec _citrus_ctype_none = { &_citrus_none_ctype_ops, /* cc_ops */ + 1 /* cc_mb_cur_max */ }; struct _citrus_ctype_rec _citrus_ctype_utf8 = { &_citrus_utf8_ctype_ops, /* cc_ops */ + _CITRUS_UTF8_MB_CUR_MAX /* cc_mb_cur_max */ }; int @@ -49,11 +51,9 @@ _citrus_ctype_open(struct _citrus_ctype_rec **rcc, char const *encname) { if (!strcmp(encname, "NONE")) { *rcc = &_citrus_ctype_none; - __mb_cur_max = 1; return (0); } else if (!strcmp(encname, "UTF8")) { *rcc = &_citrus_ctype_utf8; - __mb_cur_max = _CITRUS_UTF8_MB_CUR_MAX; return (0); } diff --git a/lib/libc/citrus/citrus_ctype_local.h b/lib/libc/citrus/citrus_ctype_local.h index 4536261df12..7753ac1513a 100644 --- a/lib/libc/citrus/citrus_ctype_local.h +++ b/lib/libc/citrus/citrus_ctype_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: citrus_ctype_local.h,v 1.3 2012/06/06 16:58:02 matthew Exp $ */ +/* $OpenBSD: citrus_ctype_local.h,v 1.4 2013/05/03 13:53:49 stsp Exp $ */ /* $NetBSD: citrus_ctype_local.h,v 1.2 2003/03/05 20:18:15 tshiozak Exp $ */ /*- @@ -81,6 +81,7 @@ struct _citrus_ctype_ops_rec { struct _citrus_ctype_rec { struct _citrus_ctype_ops_rec *cc_ops; + size_t cc_mb_cur_max; }; #endif diff --git a/lib/libc/locale/setrunelocale.c b/lib/libc/locale/setrunelocale.c index f4598692d78..aa02927c432 100644 --- a/lib/libc/locale/setrunelocale.c +++ b/lib/libc/locale/setrunelocale.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setrunelocale.c,v 1.7 2012/12/05 23:20:00 deraadt Exp $ */ +/* $OpenBSD: setrunelocale.c,v 1.8 2013/05/03 13:53:49 stsp Exp $ */ /* $NetBSD: setrunelocale.c,v 1.14 2003/08/07 16:43:07 agc Exp $ */ /*- @@ -195,6 +195,7 @@ _xpg4_setrunelocale(const char *encoding) found: _CurrentRuneLocale = rl; + __mb_cur_max = rl->rl_citrus_ctype->cc_mb_cur_max; return 0; } |