readir() is threadsafe on both linux and freebsd anyway.
The rationale behind the readdir_r() deprecation is in the glibc manual:
https://www.gnu.org/software/libc/manual/html_node/Reading_002fClosing-Directory.html
This fixes the following warning with recent glibc:
linux.c: In function ‘list_ports’:
linux.c:197:2: warning: ‘readdir_r’ is deprecated [-Wdeprecated-declarations]
while (!readdir_r(dir, &entry, &result) && result) {
^~~~~
We want to check here if we added something to the list, not if the
function argument was valid. Problem spotted by Coverity, CID 50754.
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>