Bug #600
closedOFStandard::searchDirectoryRecursively() relies on undefined HAVE_READDIR_R
100%
Description
OFStandard::searchDirectoryRecursively() checks HAVE_READDIR_R in order to determine whether to use readdir() or the thread-safe readdir_r(). However, HAVE_READDIR_R is never defined because it is neither checked by the GNU Autoconf nor the CMake configure mechanism.
What is defined and actually checked by the module "dcmwlm" is HAVE_OLD_READDIR_R (in combination with _REEENTRANT).
Updated by Jan Schlamelcher over 8 years ago
- Status changed from New to Closed
Closed by commit #a4a69b0167a08.
Updated by Jörg Riesmeier over 7 years ago
- Status changed from Closed to Reopened
- Target version changed from 3.6.2 to 3.6.6
- Operating System set to Linux
It seems that readdir_r() is deprecated and will be removed from glibc:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=859202
https://www.gnu.org/software/libc/manual/html_node/Reading_002fClosing-Directory.html
https://lwn.net/Articles/696474/
Updated by Marco Eichelberg over 7 years ago
Apparently, the glibc version in which readdir_r was first marked as deprecated is 2.24. In earlier versions of glibc and on other libc implementations we have to assume that readdir() is thread unsafe, because Posix does not require it to be thread safe.
The presence of glibc can be determined by the __GLIBC__
macro being present (after inclusion e.g. of <stdio.h> or <stdlib.h>). The version number of glibc is available at compile time with the __GLIBC__
and __GLIBC_MINOR__
macros, which resolve to the major and minor version number. The following pseudocode could be used to avoid the deprecation warning on glibc systems:
#if defined(__GLIBC__) && (((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 24)) || (__GLIBC__ >= 3)) #defined READDIR_IS_THREADSAFE #endif #if defined(HAVE_READDIR_R) && !defined(READDIR_IS_THREADSAFE) // use readdir_r() #else // use readdir() #endif
Updated by Marco Eichelberg over 7 years ago
- private/dcmpps/libsrc/ppsmgram.cc
- public/dcmpstat/apps/dcmprscu.cc
- public/dcmwlm/libsrc/wlfsim.cc
Updated by Michael Onken over 7 years ago
This bug is also listed in Debian as bug #859202.
Updated by Marco Eichelberg over 7 years ago
Fixed by commit #f421bce for public modules; commit #03a4f49 private modules.
Updated by Marco Eichelberg over 7 years ago
- Status changed from Reopened to Closed