Author: pfg
Date: Thu Aug 10 15:42:25 2017
New Revision: 322368
URL: https://svnweb.freebsd.org/changeset/base/322368

Log:
  fnmatch(3): improve POSIX conformance.
  
  In a recent interpretation[1], "\\" shall return a non-zero value
  (indicating either no match or an error).
  
  The fix involves a change over r254091 and now the behavior matches the
  Sun/IBM/HP closed source implementations and also likely musl libc.
  
  Submitted by: Joerg Schilling <joerg at schily.net>
  MFC after:    1 week
  
  [1] http://austingroupbugs.net/view.php?id=806

Modified:
  head/lib/libc/gen/fnmatch.c

Modified: head/lib/libc/gen/fnmatch.c
==============================================================================
--- head/lib/libc/gen/fnmatch.c Thu Aug 10 15:34:50 2017        (r322367)
+++ head/lib/libc/gen/fnmatch.c Thu Aug 10 15:42:25 2017        (r322368)
@@ -184,7 +184,8 @@ fnmatch1(const char *pattern, const char *string, cons
                        if (!(flags & FNM_NOESCAPE)) {
                                pclen = mbrtowc(&pc, pattern, MB_LEN_MAX,
                                    &patmbs);
-                               if (pclen == (size_t)-1 || pclen == (size_t)-2)
+                               if (pclen == 0 || pclen == (size_t)-1 ||
+                                   pclen == (size_t)-2)
                                        return (FNM_NOMATCH);
                                pattern += pclen;
                        }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to