[vlc-devel] [PATCH 4/5] filesystem: fill in input item type without HAVE_OPENAT

Thomas Guillem thomas at gllm.fr
Thu Nov 5 12:09:11 CET 2015


---
 modules/access/directory.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/modules/access/directory.c b/modules/access/directory.c
index 2e27ce9..8eb3b86 100644
--- a/modules/access/directory.c
+++ b/modules/access/directory.c
@@ -133,7 +133,24 @@ input_item_t* DirRead (access_t *p_access)
             /* net streams cannot be opened with open()/openat() */
             continue;
 #else
-        type = ITEM_TYPE_FILE;
+        {
+            char *uri;
+            if (unlikely(asprintf (&uri, "%s/%s", p_access->psz_filepath,
+                                   entry) == -1))
+                return NULL;
+
+            if (vlc_stat (uri, &st) == 0)
+            {
+                bool net;
+                type = input_stat2type (&st, &net);
+                if (type == ITEM_TYPE_UNKNOWN || net)
+                    /* net streams cannot be opened with open()/openat() */
+                    continue;
+            }
+            else /* case with a fd:// but without HAVE_OPENAT */
+                type = ITEM_TYPE_FILE;
+            free (uri);
+        }
 #endif
 
         /* Create an input item for the current entry */
-- 
2.1.4



More information about the vlc-devel mailing list