]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/x11/x11_factory.cpp
Revert "skins: use readdir_r() instead of readdir()"
[vlc] / modules / gui / skins2 / x11 / x11_factory.cpp
index 73eed0325f2898feb2a992cdf248506949d658fe..0a0768161844b4ea285e6b28c0b33a8432375dad 100644 (file)
@@ -28,7 +28,7 @@
 #include <dirent.h>
 #include <sys/stat.h>
 #include <X11/Xlib.h>
-#include <vlc_xlib.h>
+#include <limits.h>
 
 #include "x11_factory.hpp"
 #include "x11_display.hpp"
@@ -41,6 +41,9 @@
 
 #include "../src/generic_window.hpp"
 
+#include <vlc_common.h>
+#include <vlc_xlib.h>
+
 X11Factory::X11Factory( intf_thread_t *pIntf ): OSFactory( pIntf ),
     m_pDisplay( NULL ), m_pTimerLoop( NULL ), m_dirSep( "/" )
 {
@@ -205,11 +208,6 @@ void X11Factory::getMousePos( int &rXPos, int &rYPos ) const
 
 void X11Factory::rmDir( const string &rPath )
 {
-    struct
-    {
-        struct dirent ent;
-        char buf[NAME_MAX + 1];
-    } buf;
     struct dirent *file;
     DIR *dir;
 
@@ -217,7 +215,7 @@ void X11Factory::rmDir( const string &rPath )
     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;
@@ -230,7 +228,7 @@ void X11Factory::rmDir( const string &rPath )
 
         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 )
         {
             rmDir( filename );
         }