source: scripts/fetch/eglibc/2.10.1/15-fnpatch.patch@ 5856ea8

clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 5856ea8 was b17b911f, checked in by jim <clfs@…>, 15 years ago

Updated eglibc fetch script.

  • Property mode set to 100644
File size: 1.7 KB
RevLine 
[b17b911f]12005-04-12 Andreas Schwab <schwab@suse.de>
2
3 * posix/fnmatch.c (fnmatch): If conversion to wide character
4 fails fall back to single byte matching.
5
6Index: posix/fnmatch.c
7===================================================================
8--- posix/fnmatch.c.orig 2007-05-18 10:40:34.000000000 +0200
9+++ posix/fnmatch.c 2007-05-18 13:21:47.199478000 +0200
10@@ -327,6 +327,7 @@
11 # if HANDLE_MULTIBYTE
12 if (__builtin_expect (MB_CUR_MAX, 1) != 1)
13 {
14+ const char *orig_pattern = pattern;
15 mbstate_t ps;
16 size_t n;
17 const char *p;
18@@ -378,10 +379,8 @@
19 wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
20 n = mbsrtowcs (wstring, &p, n + 1, &ps);
21 if (__builtin_expect (n == (size_t) -1, 0))
22- /* Something wrong.
23- XXX Do we have to set `errno' to something which mbsrtows hasn't
24- already done? */
25- return -1;
26+ /* Something wrong. Fall back to single byte matching. */
27+ goto try_singlebyte;
28 if (p)
29 memset (&ps, '\0', sizeof (ps));
30 }
31@@ -389,10 +388,8 @@
32 {
33 n = mbsrtowcs (NULL, &string, 0, &ps);
34 if (__builtin_expect (n == (size_t) -1, 0))
35- /* Something wrong.
36- XXX Do we have to set `errno' to something which mbsrtows hasn't
37- already done? */
38- return -1;
39+ /* Something wrong. Fall back to single byte matching. */
40+ goto try_singlebyte;
41 wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
42 assert (mbsinit (&ps));
43 (void) mbsrtowcs (wstring, &string, n + 1, &ps);
44@@ -400,6 +397,9 @@
45
46 return internal_fnwmatch (wpattern, wstring, wstring + n,
47 flags & FNM_PERIOD, flags, NULL);
48+
49+ try_singlebyte:
50+ pattern = orig_pattern;
51 }
52 # endif /* mbstate_t and mbsrtowcs or _LIBC. */
53
54
Note: See TracBrowser for help on using the repository browser.