problem with scandir

Chris Wagner jwag at moose.asd.sgi.com
Thu Mar 28 02:31:33 AEST 1991


In article <1991Mar25.191630.939 at cs.ruu.nl>, markov at cs.ruu.nl (Mark
Overmars) writes:
> I have a problem with the routine scandir. After some stripping I came
up with
> the following program:
> 
> #include <sys/types.h>
> #include <sys/dir.h>
> 
> main()
> {
>   struct direct **namelist;
>   scandir("/bin", &namelist, NULL, NULL);
> }
> 
> It dumps core. It does not do so for any other directory than /bin.
> (Same behaviour on two unrelated machines.) Any reason why and any
suggestions
> how to solve it?
> 
> Mark Overmars


THis is a bug in scandir in 3.3 - having to do with how much memory
scandir will allocate to hold the directory entries. It gueses based on the
stat size of the directory using a heuristic designed for BSD FFS which
doesn't always work on EFS. If you simply add another entry to /bin it
will probably start working.

It has been fixed in 4.0

Chris Wagner



More information about the Comp.sys.sgi mailing list