sh: Cache de->d_namlen in a local variable.
This commit is contained in:
parent
81966bce06
commit
7a2b9d4b38
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=228941
@ -1186,6 +1186,7 @@ expmeta(char *enddir, char *name)
|
|||||||
int atend;
|
int atend;
|
||||||
int matchdot;
|
int matchdot;
|
||||||
int esc;
|
int esc;
|
||||||
|
int namlen;
|
||||||
|
|
||||||
metaflag = 0;
|
metaflag = 0;
|
||||||
start = name;
|
start = name;
|
||||||
@ -1284,17 +1285,18 @@ expmeta(char *enddir, char *name)
|
|||||||
if (dp->d_name[0] == '.' && ! matchdot)
|
if (dp->d_name[0] == '.' && ! matchdot)
|
||||||
continue;
|
continue;
|
||||||
if (patmatch(start, dp->d_name, 0)) {
|
if (patmatch(start, dp->d_name, 0)) {
|
||||||
if (enddir + dp->d_namlen + 1 > expdir_end)
|
namlen = dp->d_namlen;
|
||||||
|
if (enddir + namlen + 1 > expdir_end)
|
||||||
continue;
|
continue;
|
||||||
memcpy(enddir, dp->d_name, dp->d_namlen + 1);
|
memcpy(enddir, dp->d_name, namlen + 1);
|
||||||
if (atend)
|
if (atend)
|
||||||
addfname(expdir);
|
addfname(expdir);
|
||||||
else {
|
else {
|
||||||
if (enddir + dp->d_namlen + 2 > expdir_end)
|
if (enddir + namlen + 2 > expdir_end)
|
||||||
continue;
|
continue;
|
||||||
enddir[dp->d_namlen] = '/';
|
enddir[namlen] = '/';
|
||||||
enddir[dp->d_namlen + 1] = '\0';
|
enddir[namlen + 1] = '\0';
|
||||||
expmeta(enddir + dp->d_namlen + 1, endname);
|
expmeta(enddir + namlen + 1, endname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user