scandir issue on RTEMS

Joel Sherrill joel.sherrill@oarcorp.com
Thu Mar 19 17:06:00 GMT 2009


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




More information about the Newlib mailing list