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 Message-Id: <200102222240.f1MMeA708837@capella.ssd.hal.com> Subject: Re: mingwin: dirent structure d_name field is pointer not array To: cygwin AT sourceware DOT cygnus DOT com (Cygwin Mailing List) Date: Thu, 22 Feb 2001 14:40:10 -0800 (PST) In-Reply-To: from "Mumit Khan" at Feb 22, 2001 11:47:28 AM From: "J. J. Farrell" X-Mailer: ELM [version 2.5 PL3] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit > From: Mumit Khan > > On Thu, 22 Feb 2001, Reuben Thomas wrote: > > > I'm not sure if this counts as a bug, but readdir as defined by POSIX has a > > field char d_name[], but in mingwin it's a char *, which caused me a fair > > amount of grief working out why I was getting rubbish for the contents of > > directories... > > POSIX simply says that readdir() returns pointer to a structure that > contains a member named d_name, which is guaranteed to be null terminated > string; the length is unspecified, but no longer than NAME_MAX. Given > this specification, how is the Mingw behaviour not correct? SUS 2 and predecessors define d_name as rather than . I can't think of any reasonable code which would care about the difference though, especially since the length of the string is greater than the declared size of the array in some implementations anyway. I agree that it's technically wrong if it's defined as a , but I'd be interested if Reuben could give an illustration of why it matters. -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple