#include "filefunc.hxx"
#include "stringfunc.hxx"
-
namespace I2n
{
{
return false;
}
- struct dirent *entry;
- while ( NULL != (entry = ::readdir(dir)) )
+ struct dirent store, *entry = NULL;
+ while (readdir_r(dir, &store, &entry) == 0 && entry != NULL)
{
std::string name( entry->d_name );
if (! include_dot_names && (name[0] == '.') )
throw runtime_error("can't open directory " + path);
}
- struct dirent *entry;
- while ((entry = readdir(dir))) {
+ struct dirent store, *entry = NULL;
+ while (readdir_r(dir, &store, &entry) == 0 && entry != NULL)
+ {
string filename = entry->d_name;
if (filename == "." || filename == "..") {
continue;