[vlc-devel] commit: directory: do not try to open "-" as it refers to stdin ( Rémi Denis-Courmont )

git version control git at videolan.org
Wed Oct 22 22:59:28 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Wed Oct 22 23:59:00 2008 +0300| [924a7038079083f6a79a223195a87762826c15ec] | committer: Rémi Denis-Courmont 

directory: do not try to open "-" as it refers to stdin

This removes a silly error message.

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

 modules/access/directory.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/modules/access/directory.c b/modules/access/directory.c
index cb724dc..aba105f 100644
--- a/modules/access/directory.c
+++ b/modules/access/directory.c
@@ -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;
 




More information about the vlc-devel mailing list