Fix test (dentry->d_name is invalidated by closedir…)
While porting to Meson I found a bug in the test suite.
The commit name and code is pretty clear : We have to copy the
dentry->d_name before calling
closedir(). If not, the string points to nothing and the test fails (It does not fails all the time, but only by chance).