summaryrefslogtreecommitdiff
path: root/patches/glibc/ports-2.12.1/370-fnmatch.patch
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2011-05-02 22:20:04 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2011-05-02 22:20:04 (GMT)
commit0edbdfd24cf34593bc5e49ab2f3f2081de77495d (patch)
tree56ba0c8918a9a1c082f7674cb388d98f8b8fd3e0 /patches/glibc/ports-2.12.1/370-fnmatch.patch
parentc50fc857f72f1da138f3c6dca8baac824c4881ca (diff)
libc/glibc: update patchset, add ports patchset
Patchset provided by "Ioannis E. Venetis" <venetis@mail.capsl.udel.edu> http://sourceware.org/ml/crossgcc/2011-04/msg00072.html http://sourceware.org/ml/crossgcc/2011-04/msg00073.html Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Diffstat (limited to 'patches/glibc/ports-2.12.1/370-fnmatch.patch')
-rw-r--r--patches/glibc/ports-2.12.1/370-fnmatch.patch62
1 files changed, 62 insertions, 0 deletions
diff --git a/patches/glibc/ports-2.12.1/370-fnmatch.patch b/patches/glibc/ports-2.12.1/370-fnmatch.patch
new file mode 100644
index 0000000..f345b35
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/370-fnmatch.patch
@@ -0,0 +1,62 @@
+http://sourceware.org/ml/libc-hacker/2002-11/msg00071.html
+
+When fnmatch detects an invalid multibyte character it should fall back to
+single byte matching, so that "*" has a chance to match such a string.
+
+Andreas.
+
+2005-04-12 Andreas Schwab <schwab@suse.de>
+
+ * posix/fnmatch.c (fnmatch): If conversion to wide character
+ fails fall back to single byte matching.
+
+Index: posix/fnmatch.c
+===================================================================
+
+diff -durN glibc-2.12.1.orig/posix/fnmatch.c glibc-2.12.1/posix/fnmatch.c
+--- glibc-2.12.1.orig/posix/fnmatch.c 2007-07-28 22:35:00.000000000 +0200
++++ glibc-2.12.1/posix/fnmatch.c 2009-11-13 00:50:39.000000000 +0100
+@@ -327,6 +327,7 @@
+ # if HANDLE_MULTIBYTE
+ if (__builtin_expect (MB_CUR_MAX, 1) != 1)
+ {
++ const char *orig_pattern = pattern;
+ mbstate_t ps;
+ size_t n;
+ const char *p;
+@@ -382,10 +383,8 @@
+ wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
+ n = mbsrtowcs (wstring, &p, n + 1, &ps);
+ if (__builtin_expect (n == (size_t) -1, 0))
+- /* Something wrong.
+- XXX Do we have to set `errno' to something which mbsrtows hasn't
+- already done? */
+- return -1;
++ /* Something wrong. Fall back to single byte matching. */
++ goto try_singlebyte;
+ if (p)
+ {
+ memset (&ps, '\0', sizeof (ps));
+@@ -397,10 +396,8 @@
+ prepare_wstring:
+ n = mbsrtowcs (NULL, &string, 0, &ps);
+ if (__builtin_expect (n == (size_t) -1, 0))
+- /* Something wrong.
+- XXX Do we have to set `errno' to something which mbsrtows hasn't
+- already done? */
+- return -1;
++ /* Something wrong. Fall back to single byte matching. */
++ goto try_singlebyte;
+ wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
+ assert (mbsinit (&ps));
+ (void) mbsrtowcs (wstring, &string, n + 1, &ps);
+@@ -408,6 +405,9 @@
+
+ return internal_fnwmatch (wpattern, wstring, wstring + n,
+ flags & FNM_PERIOD, flags, NULL);
++
++ try_singlebyte:
++ pattern = orig_pattern;
+ }
+ # endif /* mbstate_t and mbsrtowcs or _LIBC. */
+