This reverts commit
4bf419574b51ced5dea893f9e247fe38a2a0d163.
This is not needed. readdir() uses one dirent buffer per DIR pointer,
not per process. In other words, as long as a given DIR pointer is used
in a single thread, readdir() is thread-safe.
void X11Factory::rmDir( const string &rPath )
{
void X11Factory::rmDir( const string &rPath )
{
- struct
- {
- struct dirent ent;
- char buf[NAME_MAX + 1];
- } buf;
struct dirent *file;
DIR *dir;
struct dirent *file;
DIR *dir;
if( !dir ) return;
// Parse the directory and remove everything it contains
if( !dir ) return;
// Parse the directory and remove everything it contains
- while( readdir_r( dir, &buf.ent, &file ) == 0 && file != NULL )
+ while( (file = readdir( dir )) )
{
struct stat statbuf;
string filename = file->d_name;
{
struct stat statbuf;
string filename = file->d_name;
filename = rPath + "/" + filename;
filename = rPath + "/" + filename;
- if( !stat( filename.c_str(), &statbuf ) && S_ISDIR(statbuf.st_mode) )
+ if( !stat( filename.c_str(), &statbuf ) && statbuf.st_mode & S_IFDIR )