Question

I am using the POSIX call nftw() for traversing a directory structure. The directory structure is flat - only 4 files and no subdirectories.

However when I call nftw() a lot of times on this flat directory then I get an error message after a while:

"too many open file handles".

It turned out that this happens when the flag FTW_CHDIR is used.

Would you agree that it is a bug in the Linux implementation of nftw() ?

UPDATE

A fix is now available in the glibc repositories.

here are some links to the source code I have used for testing:

UPDATE

  • MacOS-X is also hit by the bug
  • Solaris9, Solaris10 and AIX 5.3 do not have the bug
Was it helpful?

Solution

For me it looks like there is really something wrong with the nftw implementation on linux.

I have filed a bug report, see here

UPDATE: A fix is available in the glibc repositories now.

OTHER TIPS

It has the same behaviour on Mac OS 10.6.2. So probably somehow part of the specification, though I don't see how exactly.

Regarding Mac OS: bugreport submitted to Apple as radar #7640283. (No hyperlink possible, unfortunately.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top