History log of /haiku/src/system/libroot/posix/dirent.cpp
Revision Date Author Comments
# ba59081e 27-Sep-2022 Augustin Cavalier <waddlesplash@gmail.com>

libroot: Implement readdir_r in terms of readdir.

Originally _r mostly avoided the buffers in the DIR* and invoked
_kern_read_dir correctly, however that did not interact properly
with the non-reentrant functions and so this method was reworked
some years ago to check entries_left and copy results out of the buffer.

However, that was done improperly; it just copied the structs,
which as they have a VLA at the end, meant the name entry was not
copied at all if an entry was read out of the buffer.

Since we have to read entries out of the buffer anyway,
just invoke the real readdir() and then memcpy what it returns.
Use an ErrnoMaintainer to prevent errno from being affected.


# eafa0e1f 27-Sep-2022 Augustin Cavalier <waddlesplash@gmail.com>

libroot: Move dirent.c to C++.