It seems that the POSIX call nftw() doesn't clean up correctly when the flag
FTW_CHDIR is used.
one directory - without containing subdirectories - containing 4 files.
if nftw is called 1000 times as in
nftw("." , my_callback, 20, FTW_CHDIR)
then I am left with 1000 open file handles afterwards.
Created attachment 4586 [details]
source code to reproduce the issue.
download the Makefile attachment and type
This should produce two binaries
./ok - which works as expected
./buggy - which shows the described bug when executed
the only difference is that the flag FTW_CHDIR is used in ./buggy
Created attachment 4587 [details]
Makefile for the testcode
to build. See upload comment on 'main.cpp' on how to use the testcase
Fixed in git.