Fix directory detection with broken filesystems on Linux
authorRafaël Carré <funman@videolan.org>
Sun, 9 Mar 2008 11:59:53 +0000 (12:59 +0100)
committerRafaël Carré <funman@videolan.org>
Sun, 9 Mar 2008 12:18:37 +0000 (13:18 +0100)
modules/access/directory.c

index f4ceb26..7218bfd 100644 (file)
@@ -146,6 +146,13 @@ static int Open( vlc_object_t *p_this )
 {
     access_t *p_access = (access_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;