diff options
author | 2018-03-29 16:34:25 +0000 | |
---|---|---|
committer | 2018-03-29 16:34:25 +0000 | |
commit | f85ded84d67ce8e7f7589305fc9831335a4d3ad4 (patch) | |
tree | b2dfd99372a7529594cdef7f46d2f2d2c787274e /regress/lib/libc | |
parent | Add support for legacy binding used in device trees for Marvell devices for (diff) | |
download | wireguard-openbsd-f85ded84d67ce8e7f7589305fc9831335a4d3ad4.tar.xz wireguard-openbsd-f85ded84d67ce8e7f7589305fc9831335a4d3ad4.zip |
Fix three bugs in setlocale(3):
1. setlocale(LC_ALL, "A"); setlocale(LC_CTYPE, "T"); setlocale(LC_ALL, NULL);
must return "A/T/A/A/A/A", not "A". Fix this by always initializing the
LC_ALL entry of newgl to "" in dupgl(). Reported by Karl Williamson
<public at khwilliamson dot com> on bugs@, thanks!
2. Do not leak newgl when strdup(3) fails in setlocale(3).
3. For setlocale(LC_ALL, "C/C/fr_FR.UTF-8/C/C/C"); correctly set
_GlobalRuneLocale; i found 2. and 3. while looking at the code.
Feedback on a buggy earlier version and OK martijn@.
Diffstat (limited to 'regress/lib/libc')
-rw-r--r-- | regress/lib/libc/locale/setlocale/setlocale.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/regress/lib/libc/locale/setlocale/setlocale.c b/regress/lib/libc/locale/setlocale/setlocale.c index f2a84275350..82245df5c5e 100644 --- a/regress/lib/libc/locale/setlocale/setlocale.c +++ b/regress/lib/libc/locale/setlocale/setlocale.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setlocale.c,v 1.3 2017/02/25 07:28:32 jsg Exp $ */ +/* $OpenBSD: setlocale.c,v 1.4 2018/03/29 16:34:25 schwarze Exp $ */ /* * Copyright (c) 2015 Sebastien Marie <semarie@openbsd.org> * @@ -75,7 +75,6 @@ main(int argc, char *argv[]) /* load from env */ /* NOTE: we don't support non-C locales for some categories */ - /*test_setlocale("fr_FR.UTF-8", LC_ALL, "");*/ /* set */ test_setlocale("fr_FR.UTF-8", LC_CTYPE, ""); /* set */ test_setlocale("fr_FR.UTF-8", LC_MESSAGES, ""); /* set */ test_MB_CUR_MAX(4); @@ -113,6 +112,7 @@ main(int argc, char *argv[]) test_setlocale("C", LC_ALL, "C"); /* reset */ test_setlocale("invalid.UTF-8", LC_CTYPE, "invalid.UTF-8"); /* set */ test_setlocale("invalid.UTF-8", LC_CTYPE, NULL); + test_setlocale("C/invalid.UTF-8/C/C/C/C", LC_ALL, NULL); test_MB_CUR_MAX(4); /* with invalid codeset (is an error) */ |