[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#17506: [PATCH] grep: port mb_next_wc to RHEL 6.5 x86-64
From: |
Paul Eggert |
Subject: |
bug#17506: [PATCH] grep: port mb_next_wc to RHEL 6.5 x86-64 |
Date: |
Thu, 15 May 2014 18:46:51 -0700 |
* src/searchutils.c (mb_next_wc): Work around glibc bug 16950; see:
https://sourceware.org/bugzilla/show_bug.cgi?id=16950
This bug was masked in the other GNU/Linux tests I made. It was
exposed on RHEL 6.5 x86-64, where the compiler (GCC Red Hat 4.4.7-4)
happened to use temporaries in a different way.
Also see recent changes to the Gnulib documentation in this area:
http://lists.gnu.org/archive/html/bug-gnulib/2014-05/msg00013.html
---
src/searchutils.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/searchutils.c b/src/searchutils.c
index 5eb9a12..18dd584 100644
--- a/src/searchutils.c
+++ b/src/searchutils.c
@@ -285,5 +285,6 @@ mb_next_wc (char const *cur, char const *end)
{
wchar_t wc;
mbstate_t mbs = { 0 };
- return mbrtowc (&wc, cur, end - cur, &mbs) < (size_t) -2 ? wc : WEOF;
+ return (end - cur != 0 && mbrtowc (&wc, cur, end - cur, &mbs) < (size_t) -2
+ ? wc : WEOF);
}
--
1.9.0
- bug#17506: [PATCH] grep: port mb_next_wc to RHEL 6.5 x86-64,
Paul Eggert <=