[vlc-commits] sftp: error out if net_Connect fails

Petri Hintukainen git at videolan.org
Thu Mar 12 14:21:25 CET 2015


vlc | branch: master | Petri Hintukainen <phintuka at gmail.com> | Thu Mar 12 15:03:23 2015 +0200| [bd306466c8535a807725df88caf6dd79698f8234] | committer: Jean-Baptiste Kempf

sftp: error out if net_Connect fails

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

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

diff --git a/modules/access/sftp.c b/modules/access/sftp.c
index f1d0b61..b4577ac 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 )



More information about the vlc-commits mailing list