opendir() SIGSEGV on RedHat 9
Hi all
I am running into a situation where the opendir() call crashes after one
iteration of a loop in which it is located. It does not return NULL or an
errno, it just kills the whole program with a SIGSEGV. I am using it to
open and read all subdirectories of a directory - the loop executes once
(for the first subdirectory) and when it is finished, closedir() is called
on the same DIR * variable that I then, in the next iteration, use again
with the next looped opendir() call to open the next subdirectory.
Anybody else ever encountered this? Why is opendir crashing with no null
returned and no error code? It only ever runs once - any second call during
the same run of the program SIGSEGV's the whole program.
How (if my assumption here is incorrect) do you traverse subdirectories? Is
this related to a buggy libc?
Thanks!
|