1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

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.
This commit is contained in:
Jilles Tjoelker 2011-12-28 23:40:46 +00:00
parent 7a2b9d4b38
commit 6e8db49a44
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=228942

View File

@ -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] = '/';