Author: jilles Date: Wed Dec 28 23:40:46 2011 New Revision: 228942 URL: http://svn.freebsd.org/changeset/base/228942
Log: sh: Use dirent.d_type in pathname generation. This improves performance for globs where a slash or another component follows a component with metacharacters by eliminating unnecessary attempts to open directories that are not. Modified: head/bin/sh/expand.c Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Wed Dec 28 23:30:17 2011 (r228941) +++ head/bin/sh/expand.c Wed Dec 28 23:40:46 2011 (r228942) @@ -1292,6 +1292,10 @@ expmeta(char *enddir, char *name) if (atend) addfname(expdir); else { + if (dp->d_type != DT_UNKNOWN && + dp->d_type != DT_DIR && + dp->d_type != DT_LNK) + continue; if (enddir + namlen + 2 > expdir_end) continue; enddir[namlen] = '/'; _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"