about summary refs log tree commit diff
path: root/posix/fnmatch_loop.c
diff options
context:
space:
mode:
Diffstat (limited to 'posix/fnmatch_loop.c')
-rw-r--r--posix/fnmatch_loop.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/posix/fnmatch_loop.c b/posix/fnmatch_loop.c
index cab4e1b684..9445ed9c58 100644
--- a/posix/fnmatch_loop.c
+++ b/posix/fnmatch_loop.c
@@ -823,8 +823,13 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
             while ((c = *p++) != L_(']'))
               {
                 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;
+		  }
 
                 if (!(flags & FNM_NOESCAPE) && c == L_('\\'))
                   {