diff options
author | jilles <jilles@FreeBSD.org> | 2011-12-28 23:40:46 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2011-12-28 23:40:46 +0000 |
commit | 0121cc11e8024769d9c650455af23585d1f6099e (patch) | |
tree | c6f276f02519d6702acd84f1bd9001bc2ebecf83 /bin/sh | |
parent | f9224784391f6d5bc219e7779fa000ba9a68963b (diff) | |
download | FreeBSD-src-0121cc11e8024769d9c650455af23585d1f6099e.zip FreeBSD-src-0121cc11e8024769d9c650455af23585d1f6099e.tar.gz |
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.
Diffstat (limited to 'bin/sh')
-rw-r--r-- | bin/sh/expand.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c index df05a9a..75dcf5c 100644 --- a/bin/sh/expand.c +++ b/bin/sh/expand.c @@ -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] = '/'; |