[vlc-commits] input: item: do NOT preparse unknown access (fix #16823)

Francois Cartegnie git at videolan.org
Wed Apr 13 20:34:53 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Apr 13 20:30:50 2016 +0200| [8c43e3644c6d6ae9128dc543f50b9c20b6f85fdf] | committer: Francois Cartegnie

input: item: do NOT preparse unknown access (fix #16823)

Otherwise race condition with devices and exclusive access stuff.

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

 src/input/item.c |   26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/src/input/item.c b/src/input/item.c
index 0ea5fd0..2b81f7e 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -1070,22 +1070,26 @@ static int GuessType( const input_item_t *p_item, bool *p_net )
         { "vcd",    ITEM_TYPE_DISC, false },
         { "window", ITEM_TYPE_CARD, false },
     };
-    const struct item_type_entry *e;
+    int i_item_type = ITEM_TYPE_UNKNOWN;
+    *p_net = false;
 
     if( !strstr( p_item->psz_uri, "://" ) )
-        return ITEM_TYPE_FILE;
-
-    e = bsearch( p_item->psz_uri, tab, sizeof( tab ) / sizeof( tab[0] ),
-                 sizeof( tab[0] ), typecmp );
-    if( e )
     {
-        *p_net = e->b_net;
-        return e->i_type;
-    } else
+        i_item_type = ITEM_TYPE_FILE;
+    }
+    else
     {
-        *p_net = false;
-        return ITEM_TYPE_FILE;
+        const struct item_type_entry *e =
+            bsearch( p_item->psz_uri, tab, sizeof( tab ) / sizeof( tab[0] ),
+                     sizeof( tab[0] ), typecmp );
+        if( e )
+        {
+            *p_net = e->b_net;
+            return e->i_type;
+        }
     }
+
+    return i_item_type;
 }
 
 input_item_node_t *input_item_node_Create( input_item_t *p_input )



More information about the vlc-commits mailing list