From owner-svn-src-all@freebsd.org Sat Jul 30 08:53:01 2016 Return-Path: Delivered-To: svn-src-all@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 50E3DBA9319; Sat, 30 Jul 2016 08:53:01 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id 1A6A0172C; Sat, 30 Jul 2016 08:53:00 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id DE2291A3C27; Sat, 30 Jul 2016 18:52:55 +1000 (AEST) Date: Sat, 30 Jul 2016 18:52:54 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Andrey Chernov cc: Bruce Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303530 - head/lib/libc/gen In-Reply-To: <84c77b80-8b51-8698-f27a-7f6452867d66@freebsd.org> Message-ID: <20160730184454.I2661@besplex.bde.org> References: <201607300209.u6U29BXC082700@repo.freebsd.org> <20160730140305.G1962@besplex.bde.org> <84c77b80-8b51-8698-f27a-7f6452867d66@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=EfU1O6SC c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=-VkZlQZJ9cw8Qod7-jsA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2016 08:53:01 -0000 On Sat, 30 Jul 2016, Andrey Chernov wrote: > On 30.07.2016 7:15, Bruce Evans wrote: >> On Sat, 30 Jul 2016, Andrey A. Chernov wrote: >> >>> Log: >>> Reset errno for readdirfunc() before contunue. >> >> In C99, library functions are not permitted to set errno to 0. The glob() >> family shouldn't use a different (worse) convention, and POSIX doesn't >> seem to have any special wording to allow different behaviour. > > This is historic practice for this function at least since GLOB_LIMIT > was introduced (in 2001) and common across NetBSD/OpenBSD. Existent > programs may relay on that to check that limit is reached and not > allocation error, so with few additional overwriting from my side I add > nothing new: > > Revision 80525 > Modified Sun Jul 29 00:52:37 2001 UTC (15 years ago) by mikeh > ... > errno = 0 is documented. See glob(3), GLOB_NOSPACE section too. Hmm. This is not in the BUGS section. Strangely, the related non-bug that glob() may fail and set errno (to a reasonable but nonstandard and undocumented value?) is in the BUGS section. I guess this is a bug in conjunction with the promise to set errno to 0 for some failures. > The real problem is that glob(3) is very limited in error return codes, > so they reuse existent codes with errno hack. It should have just used the least-unclosely-related standard errno instead of 0. Bruce