Date: Wed, 28 Dec 2011 23:40:47 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r228942 - head/bin/sh Message-ID: <201112282340.pBSNelmW029977@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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] = '/';
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112282340.pBSNelmW029977>