directory: do not try to open "-" as it refers to stdin
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Wed, 22 Oct 2008 20:59:00 +0000 (23:59 +0300)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Wed, 22 Oct 2008 20:59:00 +0000 (23:59 +0300)
This removes a silly error message.

modules/access/directory.c

index cb724dc..aba105f 100644 (file)
@@ -143,7 +143,22 @@ static int Open( vlc_object_t *p_this )
     if( !p_access->psz_path )
         return VLC_EGENERIC;
 
-    DIR *handle = utf8_opendir (p_access->psz_path);
+    DIR *handle;
+    if (strcmp (p_access->psz_path, "-"))
+        handle = utf8_opendir (p_access->psz_path);
+    else
+    {
+#if 0   /* This won't work yet, it generates paths like "-/music.ogg".
+         * We'd need to use openat() here and in the file access... */
+        int fd = dup (0);
+        handle = fdopendir (fd);
+        if (handle == NULL)
+            close (fd);
+#else
+        return VLC_EGENERIC;
+#endif
+    }
+
     if (handle == NULL)
         return VLC_EGENERIC;