[vlc-devel] commit: Don't stat the dir if we are gonna open it one call later. ( Derk-Jan Hartman )

git version control git at videolan.org
Thu Oct 2 17:59:10 CEST 2008


vlc | branch: 0.9-bugfix | Derk-Jan Hartman <hartman at videolan.org> | Thu Oct  2 17:58:07 2008 +0200| [48b680ebfaca52bb31950947e3c02e15a2716088] | committer: Derk-Jan Hartman 

Don't stat the dir if we are gonna open it one call later.

Changed debug msg's to make sure they don't become annoying.

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

 modules/access/directory.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/modules/access/directory.c b/modules/access/directory.c
index 1aca4c2..68fec71 100644
--- a/modules/access/directory.c
+++ b/modules/access/directory.c
@@ -152,10 +152,6 @@ static int Open( vlc_object_t *p_this )
     if( !p_access->psz_path )
         return VLC_EGENERIC;
 
-    struct stat st;
-    if( !stat( p_access->psz_path, &st ) && !S_ISDIR( st.st_mode ) )
-        return VLC_EGENERIC;
-
     DIR *handle = OpenDir (p_this, p_access->psz_path);
     if (handle == NULL)
         return VLC_EGENERIC;
@@ -573,18 +569,17 @@ static int ReadDir( access_t *p_access, playlist_t *p_playlist,
 
 static DIR *OpenDir (vlc_object_t *obj, const char *path)
 {
-    msg_Dbg (obj, "opening directory `%s'", path);
     DIR *handle = utf8_opendir (path);
     if (handle == NULL)
     {
         int err = errno;
         if (err != ENOTDIR)
             msg_Err (obj, "%s: %m", path);
-        else
-            msg_Dbg (obj, "skipping non-directory `%s'", path);
+        // else not a dir
         errno = err;
 
         return NULL;
     }
+    msg_Dbg (obj, "opening directory `%s'", path);
     return handle;
 }




More information about the vlc-devel mailing list