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:
parent
7a2b9d4b38
commit
6e8db49a44
@ -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] = '/';
|
||||
|
Loading…
Reference in New Issue
Block a user