Commit 4bf41957 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

skins: use readdir_r() instead of readdir()

parent ed9336c9
...@@ -201,6 +201,11 @@ void X11Factory::getMousePos( int &rXPos, int &rYPos ) const ...@@ -201,6 +201,11 @@ void X11Factory::getMousePos( int &rXPos, int &rYPos ) const
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; struct dirent *file;
DIR *dir; DIR *dir;
...@@ -208,7 +213,7 @@ void X11Factory::rmDir( const string &rPath ) ...@@ -208,7 +213,7 @@ void X11Factory::rmDir( const string &rPath )
if( !dir ) return; if( !dir ) return;
// Parse the directory and remove everything it contains // Parse the directory and remove everything it contains
while( (file = readdir( dir )) ) while( readdir_r( dir, &buf.ent, &file ) == 0 && file != NULL )
{ {
struct stat statbuf; struct stat statbuf;
string filename = file->d_name; string filename = file->d_name;
...@@ -221,7 +226,7 @@ void X11Factory::rmDir( const string &rPath ) ...@@ -221,7 +226,7 @@ void X11Factory::rmDir( const string &rPath )
filename = rPath + "/" + filename; filename = rPath + "/" + filename;
if( !stat( filename.c_str(), &statbuf ) && statbuf.st_mode & S_IFDIR ) if( !stat( filename.c_str(), &statbuf ) && S_ISDIR(statbuf.st_mode) )
{ {
rmDir( filename ); rmDir( filename );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment