Mercurial > hg > octave-jordi > gnulib-hg
changeset 14738:51a0158159b6
fnmatch: sync glibc change fixing Bugzilla bug #12378
* lib/fnmatch_loop.c (FCT): When matching '[' keep track of
beginning and fall back to matching as normal character if the
string ends before the matching ']' is found. This is what POSIX
requires.
author | James Youngman <jay@gnu.org> |
---|---|
date | Thu, 12 May 2011 22:14:11 +0100 |
parents | e91d05814c25 |
children | fa334fc6c425 |
files | ChangeLog lib/fnmatch_loop.c |
diffstat | 2 files changed, 17 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-05-11 Ulrich Drepper <drepper@gmail.com> + + Sync glibc change fixing Bugzilla bug #12378. + * lib/fnmatch_loop.c (FCT): When matching '[' keep track of + beginning and fall back to matching as normal character if the + string ends before the matching ']' is found. This is what POSIX + requires. + 2011-05-13 Eric Blake <eblake@redhat.com> getcwd-lgpl: relax test for FreeBSD
--- a/lib/fnmatch_loop.c +++ b/lib/fnmatch_loop.c @@ -200,6 +200,8 @@ case L_('['): { /* Nonzero if the sense of the character class is inverted. */ + CHAR *p_init = p; + CHAR *n_init = n; register bool not; CHAR cold; UCHAR fn; @@ -410,8 +412,13 @@ } #endif else if (c == L_('\0')) - /* [ (unterminated) loses. */ - return FNM_NOMATCH; + { + /* [ unterminated, treat as normal character. */ + p = p_init; + n = n_init; + c = L_('['); + goto normal_match; + } else { bool is_range = false;