Dne 30.6.2016 v 17:30 Kaleb KEITHLEY napsal(a):
Hi,
Does anyone have a good/working autoconf test for checking for
deprecated readdir_r (for Fedora 25) ?
I'm not having much luck. (Have tried AC_COMPILE_IFELSE, among other
things.)
Alternatively it would be nice if there was a some kind of feature test
define in dirent.h.
Cut & paste example code solution from lvm2:
#if !defined(__GLIBC__) || (__GLIBC__ < 2) || ((__GLIBC__ == 2) &&
(__GLIBC_MINOR__ < 23))
/* readdir_r is deprecated with newer GLIBC */
struct dirent entry, *iter = 0;
while ( (errno = readdir_r( d.d, &entry, &iter )) == 0 && iter ) {
std::string ename( entry.d_name );
#else
struct dirent *entry;
errno = 0;
while ( (entry = readdir( d.d )) ) {
std::string ename( entry->d_name );
#endif
No need for autoconf....
Regards
Zdenek
--
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://lists.fedoraproject.org/admin/lists/devel@xxxxxxxxxxxxxxxxxxxxxxx