Rework r303074 case 4. Don't immediatelly skip directory entries which

cause MAXPATHLEN exceeded. Process them first through gl_errfunc() and
GLOB_ERR.
This commit is contained in:
Andrey A. Chernov 2016-07-30 03:11:54 +00:00
parent 6d1ffb50fc
commit 15cb786674

View File

@ -803,6 +803,13 @@ glob3(Char *pathbuf, Char *pathend, Char *pathend_last,
}
sc += clen;
}
if (too_long && ((pglob->gl_errfunc != NULL &&
pglob->gl_errfunc(buf, ENAMETOOLONG)) ||
(pglob->gl_flags & GLOB_ERR))) {
errno = ENAMETOOLONG;
err = GLOB_ABORTED;
break;
}
if (too_long || !match(pathend, pattern, restpattern)) {
*pathend = EOS;
errno = 0;