summaryrefslogtreecommitdiff
path: root/modules/mbrtowc
diff options
context:
space:
mode:
authorPaul Eggert <eggert@penguin.cs.ucla.edu>2016-04-09 01:28:36 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2016-04-09 01:29:09 -0700
commitb7bc3c1a4e78add4cbad39ae1a0c4fb0747b483f (patch)
treeaf19a91c264378e3e6e93b9b362c393d9ab8139f /modules/mbrtowc
parent29ea6d6fe2a699a32edbe29f44fe72e0c253fcee (diff)
downloadgnulib-b7bc3c1a4e78add4cbad39ae1a0c4fb0747b483f.tar.gz
mbrtowc: work around glibc bug#19932
Fix mbrtowc so that it never returns -1 in the C locale, as this conflicts with a future version of POSIX http://austingroupbugs.net/view.php?id=663#c2738 and causes problems with GNU grep: http://bugs.gnu.org/23234 See glibc bug 19932: https://sourceware.org/bugzilla/show_bug.cgi?id=19932 * doc/posix-functions/mbrlen.texi (mbrlen): * doc/posix-functions/mbrtowc.texi (mbrtowc): Document the glibc bug. * lib/mbrtowc.c [C_LOCALE_MAYBE_EILSEQ]: Include hard-locale.h, locale.h. (rpl_mbrtowc): Work around the C_LOCALE_MAYBE_EILSEQ bug, if the bug is possible. * m4/mbrtowc.m4 (gl_MBRTOWC_C_LOCALE): New macro. (gl_FUNC_MBRTOWC): Use it, and define C_LOCALE_MAYBE_EILSEQ as needed. * modules/hard-locale (License): Now LGPLv2+, for mbrtowc. * modules/mbrtowc (Depends-on): Add hard-locale. * modules/mbrtowc-tests (Files, TESTS): Add tests/test-mbrtowc5.sh. * tests/test-mbrtowc.c (main): Test for bug fix if arg is '5'. * tests/test-mbrtowc5.sh: New file.
Diffstat (limited to 'modules/mbrtowc')
-rw-r--r--modules/mbrtowc1
1 files changed, 1 insertions, 0 deletions
diff --git a/modules/mbrtowc b/modules/mbrtowc
index 4e90b67e3b..bd951ae7c1 100644
--- a/modules/mbrtowc
+++ b/modules/mbrtowc
@@ -13,6 +13,7 @@ m4/codeset.m4
Depends-on:
wchar
extensions
+hard-locale [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
mbsinit [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
localcharset [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
streq [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]