Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/lib/libc/gen/glob.c,v rcsdiff: /ftp/cvs/cvsroot/src/lib/libc/gen/glob.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.33 retrieving revision 1.35.8.1 diff -u -p -r1.33 -r1.35.8.1 --- src/lib/libc/gen/glob.c 2012/12/27 21:17:47 1.33 +++ src/lib/libc/gen/glob.c 2016/09/18 06:10:31 1.35.8.1 @@ -1,4 +1,4 @@ -/* $NetBSD: glob.c,v 1.33 2012/12/27 21:17:47 christos Exp $ */ +/* $NetBSD: glob.c,v 1.35.8.1 2016/09/18 06:10:31 snj Exp $ */ /* * Copyright (c) 1989, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93"; #else -__RCSID("$NetBSD: glob.c,v 1.33 2012/12/27 21:17:47 christos Exp $"); +__RCSID("$NetBSD: glob.c,v 1.35.8.1 2016/09/18 06:10:31 snj Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -87,9 +87,9 @@ __RCSID("$NetBSD: glob.c,v 1.33 2012/12/ #define NO_GETPW_R #endif -#define GLOB_LIMIT_STRING 65536 /* number of readdirs */ +#define GLOB_LIMIT_STRING 524288 /* number of readdirs */ #define GLOB_LIMIT_STAT 128 /* number of stat system calls */ -#define GLOB_LIMIT_READDIR 16384 /* total buffer size of path strings */ +#define GLOB_LIMIT_READDIR 65536 /* total buffer size of path strings */ #define GLOB_LIMIT_PATH 1024 /* number of path elements */ #define GLOB_LIMIT_BRACE 128 /* Number of brace calls */ @@ -132,7 +132,7 @@ struct glob_limit { #define M_MASK 0xffff #define M_ASCII 0x00ff -typedef u_short Char; +typedef unsigned short Char; #else @@ -183,14 +183,14 @@ int glob(const char * __restrict pattern, int flags, int (*errfunc)(const char *, int), glob_t * __restrict pglob) { - const u_char *patnext; + const unsigned char *patnext; int c; Char *bufnext, *bufend, patbuf[MAXPATHLEN+1]; struct glob_limit limit = { 0, 0, 0, 0 }; _DIAGASSERT(pattern != NULL); - patnext = (const u_char *) pattern; + patnext = (const unsigned char *) pattern; if (!(flags & GLOB_APPEND)) { pglob->gl_pathc = 0; pglob->gl_pathv = NULL; @@ -612,8 +612,6 @@ glob2(Char *pathbuf, Char *pathend, Char const Char *p; Char *q; int anymeta; - Char *pend; - ptrdiff_t diff; _DIAGASSERT(pathbuf != NULL); _DIAGASSERT(pathend != NULL); @@ -665,26 +663,7 @@ glob2(Char *pathbuf, Char *pathend, Char *q++ = *p++; } - /* - * No expansion, or path ends in slash-dot shash-dot-dot, - * do next segment. - */ - if (pglob->gl_flags & GLOB_PERIOD) { - for (pend = pathend; pend > pathbuf && pend[-1] == '/'; - pend--) - continue; - diff = pend - pathbuf; - } else { - /* XXX: GCC */ - diff = 0; - pend = pathend; - } - - if ((!anymeta) || - ((pglob->gl_flags & GLOB_PERIOD) && - (diff >= 1 && pend[-1] == DOT) && - (diff >= 2 && (pend[-2] == SLASH || pend[-2] == DOT)) && - (diff < 3 || pend[-3] == SLASH))) { + if (!anymeta) { pathend = q; pattern = p; while (*pattern == SEP) { @@ -791,7 +770,7 @@ glob3(Char *pathbuf, Char *pathend, Char else readdirfunc = (struct dirent *(*)(void *)) readdir; while ((dp = (*readdirfunc)(dirp)) != NULL) { - u_char *sc; + unsigned char *sc; Char *dc; if ((pglob->gl_flags & GLOB_LIMIT) && @@ -822,7 +801,7 @@ glob3(Char *pathbuf, Char *pathend, Char * The resulting string contains EOS, so we can * use the pathlim character, if it is the nul */ - for (sc = (u_char *) dp->d_name, dc = pathend; + for (sc = (unsigned char *) dp->d_name, dc = pathend; dc <= pathlim && (*dc++ = *sc++) != EOS;) continue;