This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: scandir issue on RTEMS


Joel:
     It seems like the user's report was meant to be attached but was
not.
     I was searching for MAXNAMLEN a while ago, and did not find
anything standard--although I could have missed it.  The best that I
could tell is that NAME_MAX (from POSIX) is what ought to be used in
dirent.h.  NAME_MAX should be defined in limits.h.  If a MAXNAMLEN (I
did
not find MAXNAMELEN in Newlib) is needed to be compatible with old
oddball
code that people have from somewhere, a suggestion is that it should be
in
limits.h to be the same as NAME_MAX (i.e. #define MAXNAMLEN NAME_MAX).
     (Another related puzzle is how NAME_MAX relates to C's
FILENAME_MAX.)
				Craig

-----Original Message-----
From: newlib-owner@sourceware.org [mailto:newlib-owner@sourceware.org]
On Behalf Of Joel Sherrill
Sent: Thursday, March 19, 2009 12:07 PM
To: newlib@sources.redhat.com
Subject: scandir issue on RTEMS

Hi,

I got this report from a user and wondered if someone
could provide a recommendation.  I am getting wrapped
around the axle trying to figure out what should be
set by whom where.

It is used in scandir() (newlib-1.17.0/newlib/libc/posix/scandir.c:117) 
by the macro DIRSIZ. Where DIRSIZ uses the MAXNAMELEN define which is 
set incorrectly. It does not match the sizeof(struct dirent) which makes

the DIRSIZ return a negative number, then malloc(DIRSIZ(d)) will try to 
allocate 4GB which fail.

My guess is that MAXNAMELEN should be defined in 
newlib-1.17.0/newlib/libc/sys/rtems/sys/dirent.h or 
newlib-1.17.0/newlib/libc/sys/rtems/include/limits.h or in a new file.


-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill@OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]