[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/2] Sync glibc change fixing Bugzilla bug #12378.
From: |
James Youngman |
Subject: |
[PATCH 1/2] Sync glibc change fixing Bugzilla bug #12378. |
Date: |
Thu, 12 May 2011 22:14:11 +0100 |
From: James Youngman <address@hidden>
* 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.
---
ChangeLog | 8 ++++++++
lib/fnmatch_loop.c | 11 +++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e8e37db..680cd16 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-05-11 Ulrich Drepper <address@hidden>
+
+ 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-11 Eric Blake <address@hidden>
fclose: preserve fflush errors
diff --git a/lib/fnmatch_loop.c b/lib/fnmatch_loop.c
index ed760dd..1fb246f 100644
--- a/lib/fnmatch_loop.c
+++ b/lib/fnmatch_loop.c
@@ -200,6 +200,8 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR
*string_end,
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 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR
*string_end,
}
#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;
--
1.7.2.5
- [PATCH 1/2] Sync glibc change fixing Bugzilla bug #12378.,
James Youngman <=