[vlc-devel] commit: Don't waste stat() right before opendir(). ( Rémi Denis-Courmont )

git version control git at videolan.org
Tue May 20 18:02:23 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Tue May 20 18:54:59 2008 +0300| [be24a28f94929ecca09911d4659dec0484cc1de5]

Don't waste stat() right before opendir().

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=be24a28f94929ecca09911d4659dec0484cc1de5
---

 modules/control/http/util.c |   13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/modules/control/http/util.c b/modules/control/http/util.c
index b85857a..3ebc889 100644
--- a/modules/control/http/util.c
+++ b/modules/control/http/util.c
@@ -111,9 +111,6 @@ int ParseDirectory( intf_thread_t *p_intf, char *psz_root,
 {
     intf_sys_t     *p_sys = p_intf->p_sys;
     char           dir[MAX_DIR_SIZE];
-#ifdef HAVE_SYS_STAT_H
-    struct stat   stat_info;
-#endif
     DIR           *p_dir;
     vlc_acl_t     *p_acl;
     FILE          *file;
@@ -131,16 +128,10 @@ int ParseDirectory( intf_thread_t *p_intf, char *psz_root,
     sep = '/';
 #endif
 
-#ifdef HAVE_SYS_STAT_H
-    if( utf8_stat( psz_dir, &stat_info ) == -1 || !S_ISDIR( stat_info.st_mode ) )
-    {
-        return VLC_EGENERIC;
-    }
-#endif
-
     if( ( p_dir = utf8_opendir( psz_dir ) ) == NULL )
     {
-        msg_Err( p_intf, "cannot open directory (%s)", psz_dir );
+        if( errno != ENOENT && errno != ENOTDIR )
+            msg_Err( p_intf, "cannot open directory (%s)", psz_dir );
         return VLC_EGENERIC;
     }
 




More information about the vlc-devel mailing list