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

Petri Hintukainen git at videolan.org
Thu Mar 12 18:58:16 CET 2015


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

sftp: error out if net_Connect fails

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit bd306466c8535a807725df88caf6dd79698f8234)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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