svn commit: r303536 - head/lib/libc/gen

Andrey A. Chernov ache at FreeBSD.org
Sat Jul 30 03:11:55 UTC 2016


Author: ache
Date: Sat Jul 30 03:11:54 2016
New Revision: 303536
URL: https://svnweb.freebsd.org/changeset/base/303536

Log:
  Rework r303074 case 4. Don't immediatelly skip directory entries which
  cause MAXPATHLEN exceeded. Process them first through gl_errfunc() and
  GLOB_ERR.

Modified:
  head/lib/libc/gen/glob.c

Modified: head/lib/libc/gen/glob.c
==============================================================================
--- head/lib/libc/gen/glob.c	Sat Jul 30 03:11:53 2016	(r303535)
+++ head/lib/libc/gen/glob.c	Sat Jul 30 03:11:54 2016	(r303536)
@@ -803,6 +803,13 @@ glob3(Char *pathbuf, Char *pathend, Char
 			}
 			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;


More information about the svn-src-head mailing list