]> git.sesse.net Git - vlc/blobdiff - modules/access/directory.c
Fix directory detection with broken filesystems on Linux
[vlc] / modules / access / directory.c
index f4ceb264ce1df8b23636d22de461af7a2fc1b5c1..7218bfd293f53531356e24983497df955d862e91 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;