]> git.sesse.net Git - vlc/commitdiff
module_need: give up if pf_activate returns VLC_ETIMEOUT (fixes: #2872)
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 2 Aug 2009 17:10:09 +0000 (20:10 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 2 Aug 2009 17:10:09 +0000 (20:10 +0300)
A plugin can use this if it matched but detected a non-recoverable error
while inside the open callback. Help yourself if you want a "better"
error code.

src/modules/modules.c

index f1c197480c889696784cd14c3be460b829dc45bf..3d07c64e92fad1ac6089d6656d1489033b7cbab9 100644 (file)
@@ -580,16 +580,30 @@ found_shortcut:
 #endif
 
         p_this->b_force = p_list[i].b_force;
-        if( p_cand->pf_activate
-         && p_cand->pf_activate( p_this ) == VLC_SUCCESS )
+
+        int ret = VLC_SUCCESS;
+        if( p_cand->pf_activate )
+            ret = p_cand->pf_activate( p_this );
+        switch( ret )
         {
+        case VLC_SUCCESS:
+            /* good module! */
             p_module = p_cand;
-            /* Release the remaining modules */
-            while (++i < count)
-                module_release (p_list[i].p_module);
-        }
-        else
+            break;
+
+        case VLC_ETIMEOUT:
+            /* good module, but aborted */
             module_release( p_cand );
+            break;
+
+        default: /* bad module */
+            module_release( p_cand );
+            continue;
+        }
+
+        /* Release the remaining modules */
+        while (++i < count)
+            module_release (p_list[i].p_module);
     }
 
     free( p_list );