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

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

Updated eglibc fetch script.

  • Property mode set to 100644
File size: 1.7 KB
  • posix/fnmatch.c

    2005-04-12  Andreas Schwab  <schwab@suse.de>
    
    	* posix/fnmatch.c (fnmatch): If conversion to wide character
    	fails fall back to single byte matching.
    
    old new  
    327327# if HANDLE_MULTIBYTE
    328328  if (__builtin_expect (MB_CUR_MAX, 1) != 1)
    329329    {
     330      const char *orig_pattern = pattern;
    330331      mbstate_t ps;
    331332      size_t n;
    332333      const char *p;
     
    378379          wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
    379380          n = mbsrtowcs (wstring, &p, n + 1, &ps);
    380381          if (__builtin_expect (n == (size_t) -1, 0))
    381             /* Something wrong.
    382                XXX Do we have to set `errno' to something which mbsrtows hasn't
    383                already done?  */
    384             return -1;
     382            /* Something wrong.  Fall back to single byte matching.  */
     383            goto try_singlebyte;
    385384          if (p)
    386385            memset (&ps, '\0', sizeof (ps));
    387386        }
     
    389388        {
    390389          n = mbsrtowcs (NULL, &string, 0, &ps);
    391390          if (__builtin_expect (n == (size_t) -1, 0))
    392             /* Something wrong.
    393                XXX Do we have to set `errno' to something which mbsrtows hasn't
    394                already done?  */
    395             return -1;
     391            /* Something wrong.  Fall back to single byte matching.  */
     392            goto try_singlebyte;
    396393          wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
    397394          assert (mbsinit (&ps));
    398395          (void) mbsrtowcs (wstring, &string, n + 1, &ps);
     
    400397
    401398      return internal_fnwmatch (wpattern, wstring, wstring + n,
    402399                                flags & FNM_PERIOD, flags, NULL);
     400
     401    try_singlebyte:
     402      pattern = orig_pattern;
    403403    }
    404404# endif  /* mbstate_t and mbsrtowcs or _LIBC.  */
    405405
Note: See TracBrowser for help on using the repository browser.