[vlc-devel] [PATCH] sftp: error out if net_Connect fails

Petri Hintukainen phintuka at users.sourceforge.net
Thu Mar 12 14:03:23 CET 2015


From: Petri Hintukainen <phintuka at gmail.com>

---
 modules/access/sftp.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/access/sftp.c b/modules/access/sftp.c
index 28da484..5946fa3 100644
--- a/modules/access/sftp.c
+++ b/modules/access/sftp.c
@@ -144,6 +144,11 @@ static int Open( vlc_object_t* p_this )
 
     /* Connect to the server using a regular socket */
     p_sys->i_socket = net_Connect( p_access, url.psz_host, i_port, SOCK_STREAM, 0 );
+    if( p_sys->i_socket < 0 )
+    {
+        msg_Err( p_access, "Impossible to open the connection to %s:%i", url.psz_host, i_port );
+        goto error;
+    }
 
     /* Create the ssh connexion and wait until the server answer */
     if( ( p_sys->ssh_session = libssh2_session_init() ) == NULL )
-- 
2.1.0




More information about the vlc-devel mailing list