From owner-svn-src-all@freebsd.org Sat Jul 30 04:39:24 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 8C071BA8D2F for ; Sat, 30 Jul 2016 04:39:24 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com [209.85.215.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1D1881AFC for ; Sat, 30 Jul 2016 04:39:23 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f51.google.com with SMTP id l69so83367157lfg.1 for ; Fri, 29 Jul 2016 21:39:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=xqAd4VFFeC5I5pqiTTVdXnTrm6QoKt+9jZPE+YT3z+k=; b=S+VwrixdbQGBNeri0dIbIJnZBgjQr2IdiBf6AIkLKoNkU71y3zRPUMvQdr6kXv31Vv F0IPipCO1fHrfFQ/9OwR2CN3oAXZUSEKx9ihECDW1A+DDmaLw1Bur3Fsa7SEWbR/mbNK 68CR8fyXWg0YedE4UmJoxMsUJ3fGpXhtyAubLt6YwRwG5BE3G0VHew2GyRVYBcaYRPfN 00v9SdqI33/0dIN8mjfUO4pUEaqYytMMSr5876ZQjDm21j4JX/EOLZZcXjZMrLGH3c4H YUU8UW0zpLdXvmYcf/J5uK9P1HhXmbQhqpVVNC54UymUzZQhKG7Xcn97EGAS7vm9JHV0 WI+Q== X-Gm-Message-State: AEkoouv1HHuw6/piUkBMcDfOF1tcyJiraTrte750nuaMRbBJF/kziNRomfTH0PM6AhPhEA== X-Received: by 10.25.41.142 with SMTP id p136mr16301321lfp.32.1469853057559; Fri, 29 Jul 2016 21:30:57 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id r196sm3242672lfd.41.2016.07.29.21.30.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Jul 2016 21:30:57 -0700 (PDT) Subject: Re: svn commit: r303530 - head/lib/libc/gen To: Bruce Evans References: <201607300209.u6U29BXC082700@repo.freebsd.org> <20160730140305.G1962@besplex.bde.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Andrey Chernov Message-ID: <84c77b80-8b51-8698-f27a-7f6452867d66@freebsd.org> Date: Sat, 30 Jul 2016 07:30:55 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160730140305.G1962@besplex.bde.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 04:39:24 -0000 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 Rename the GLOB_MAXPATH flag of glob(3) to GLOB_LIMIT to be compatible with NetBSD and OpenBSD. glob(3) will now return GLOB_NOSPACE with errno set to 0 instead of GLOB_LIMIT when we match more than `gl_matchc' patterns. GLOB_MAXPATH has been left as an alias of GLOB_LIMIT to maintain backwards compatibility. errno = 0 is documented. See glob(3), GLOB_NOSPACE section too. The real problem is that glob(3) is very limited in error return codes, so they reuse existent codes with errno hack.