From owner-svn-src-head@freebsd.org Mon Jul 18 19:20:50 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87333B9DA84; Mon, 18 Jul 2016 19:20:50 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59EB41EA9; Mon, 18 Jul 2016 19:20:50 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6IJKn7i087515; Mon, 18 Jul 2016 19:20:49 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6IJKnXS087514; Mon, 18 Jul 2016 19:20:49 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607181920.u6IJKnXS087514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Mon, 18 Jul 2016 19:20:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303011 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jul 2016 19:20:50 -0000 Author: ache Date: Mon Jul 18 19:20:49 2016 New Revision: 303011 URL: https://svnweb.freebsd.org/changeset/base/303011 Log: Change patch from r303004 case 3. According to POSIX gl_errfunc should be called first, then GLOB_ERR should be considered. Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Mon Jul 18 18:24:31 2016 (r303010) +++ head/lib/libc/gen/glob.c Mon Jul 18 19:20:49 2016 (r303011) @@ -714,9 +714,7 @@ glob3(Char *pathbuf, Char *pathend, Char if ((dirp = g_opendir(pathbuf, pglob)) == NULL) { if (errno == ENOENT || errno == ENOTDIR) return (0); - if (pglob->gl_flags & GLOB_ERR) - return (GLOB_ABORTED); - if (pglob->gl_errfunc) { + if (pglob->gl_errfunc != NULL) { if (g_Ctoc(pathbuf, buf, sizeof(buf))) { errno = 0; return (GLOB_NOSPACE); @@ -724,6 +722,8 @@ glob3(Char *pathbuf, Char *pathend, Char if (pglob->gl_errfunc(buf, errno)) return (GLOB_ABORTED); } + if (pglob->gl_flags & GLOB_ERR) + return (GLOB_ABORTED); return (0); }