[vlc-devel] [PATCH] ftp: Don't assert on a valid connection handle in Read()

Hugo Beauzée-Luyssen hugo at beauzee.fr
Thu Mar 8 13:55:10 CET 2018


When seeking, if the reconnection fails, the connection handle will be
NULL. Instead, try to reconnect and signal EOF if this can't be done.
---
 modules/access/ftp.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/access/ftp.c b/modules/access/ftp.c
index a5ad4ddabd..f430f1f918 100644
--- a/modules/access/ftp.c
+++ b/modules/access/ftp.c
@@ -900,7 +900,12 @@ static ssize_t Read( stream_t *p_access, void *p_buffer, size_t i_len )
 {
     access_sys_t *p_sys = p_access->p_sys;
 
-    assert( p_sys->data != NULL );
+    if( p_sys->data == NULL )
+    {
+        if( ftp_StartStream( VLC_OBJECT(p_access), p_sys, p_sys->offset,
+                             false ) != VLC_SUCCESS )
+            return 0;
+    }
     assert( !p_sys->out );
 
     ssize_t i_read = vlc_tls_Read( p_sys->data, p_buffer, i_len, false );
-- 
2.11.0



More information about the vlc-devel mailing list