Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Fri, 5 Oct 2001 11:06:06 -0400 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: getcwd() problem Message-ID: <20011005110606.H13996@redhat.com> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <200110051213 DOT VAA12158 AT mail DOT raidway DOT ne DOT jp> <17911642410 DOT 20011005162352 AT logos-m DOT ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17911642410.20011005162352@logos-m.ru> User-Agent: Mutt/1.3.21i On Fri, Oct 05, 2001 at 04:23:52PM +0400, egor duda wrote: >Hi! > >Friday, 05 October, 2001 Yasushi Higuchi yzone AT mail DOT raidway DOT ne DOT jp wrote: > >YH> I found a problem in the getcwd() function in recent snapshot. > >[...] >>> char *cwd = getcwd(NULL, 256); >[...] > >Single Unix Specification v2 says that "If buf is a null pointer, the >behaviour of getcwd() is undefined." > >YH> Reference: FreeBSD manpages >>>STANDARDS >>>The getcwd() function conforms to ISO 9899: 1990 (``ISO C''). The ability >>>to specify a NULL pointer and have getcwd() allocate memory as necessary >>>is an extension. > >cygwin doesn't support this extension. it's arguable whether it should >be added or not. code that implicitly allocates (on doesn't allocate, >depending in parameters) memory on heap is a source of potential >memory leaks. It's supposed to support it, though. There is code to handle this but recent pointer validation checks were a little too aggressive for the getcwd case. I've checked in a fix for this. cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/