From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4117 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] getcwd: Set errno to EINVAL when size == 0 Date: Tue, 8 Oct 2013 19:48:34 -0400 Message-ID: <20131008234834.GK20515@brightrain.aerifal.cx> References: <1381126104-24579-1-git-send-email-mforney@mforney.org> <1381127894.6107.59.camel@eris.loria.fr> <20131007162157.GC20515@brightrain.aerifal.cx> <525343fb.42e5440a.723b.766b@mx.google.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1381276123 25790 80.91.229.3 (8 Oct 2013 23:48:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 8 Oct 2013 23:48:43 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4121-gllmg-musl=m.gmane.org@lists.openwall.com Wed Oct 09 01:48:47 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1VTh1D-00032A-7s for gllmg-musl@plane.gmane.org; Wed, 09 Oct 2013 01:48:47 +0200 Original-Received: (qmail 17528 invoked by uid 550); 8 Oct 2013 23:48:46 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 17517 invoked from network); 8 Oct 2013 23:48:46 -0000 Content-Disposition: inline In-Reply-To: <525343fb.42e5440a.723b.766b@mx.google.com> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:4117 Archived-At: On Mon, Oct 07, 2013 at 04:29:53PM -0700, Michael Forney wrote: > On Mon, 07 Oct 2013 12:21:57 -0400, Rich Felker wrote: > > In principle the kernel should be generating the EINVAL if size is 0, > > but maybe it does the wrong thing...? > > Yeah, from what I could tell, it returns ERANGE in all cases where it > can't fit the cwd into the buffer. OK, I think that clears it up then. For now I'll apply your patch (and at the same time, replace the if branch with a proper block instead of the ugly comma operator hack) and we can worry about the glibc issue later. Rich