Ticket #3036: 3036_fix.patch

File 3036_fix.patch, 2.4 KB (added by andrew_b, 11 years ago)

Quick fix

  • src/vfs/sftpfs/connection.c

    diff --git a/src/vfs/sftpfs/connection.c b/src/vfs/sftpfs/connection.c
    index 83e33d0..69c854d 100644
    a b sftpfs_open_connection (struct vfs_s_super *super, GError ** error) 
    376376     */ 
    377377    super_data->socket_handle = sftpfs_open_socket (super, error); 
    378378    if (super_data->socket_handle == -1) 
    379         goto deinit_by_error; 
     379        return -1; 
    380380 
    381381    /* ... start it up. This will trade welcome banners, exchange keys, 
    382382     * and setup crypto, compression, and MAC layers 
    sftpfs_open_connection (struct vfs_s_super *super, GError ** error) 
    385385    if (rc != 0) 
    386386    { 
    387387        g_set_error (error, MC_ERROR, -1, _("sftp: Failure establishing SSH session: (%d)"), rc); 
    388         goto deinit_by_error; 
     388        return -1; 
    389389    } 
    390390 
    391391    /* At this point we havn't yet authenticated.  The first thing to do 
    sftpfs_open_connection (struct vfs_s_super *super, GError ** error) 
    400400    if (!sftpfs_open_connection_ssh_agent (super, error) 
    401401        && !sftpfs_open_connection_ssh_key (super, error) 
    402402        && !sftpfs_open_connection_ssh_password (super, error)) 
    403         goto deinit_by_error; 
     403        return -1; 
    404404 
    405405    super_data->sftp_session = libssh2_sftp_init (super_data->session); 
    406406 
    407407    if (super_data->sftp_session == NULL) 
    408         goto deinit_by_error; 
     408        return -1; 
    409409 
    410410    /* Since we have not set non-blocking, tell libssh2 we are blocking */ 
    411411    libssh2_session_set_blocking (super_data->session, 1); 
    412412 
    413413    return 0; 
    414  
    415   deinit_by_error: 
    416     sftpfs_close_connection (super, "Shutdown with errors", NULL); 
    417     return -1; 
    418414} 
    419415 
    420416/* --------------------------------------------------------------------------------------------- */ 
    sftpfs_close_connection (struct vfs_s_super *super, const char *shutdown_message 
    438434        return; 
    439435 
    440436    vfs_path_element_free (super_data->original_connection_info); 
     437    super_data->original_connection_info = NULL; 
     438 
    441439    if (super_data->agent != NULL) 
    442440    { 
    443441        libssh2_agent_disconnect (super_data->agent); 
    sftpfs_close_connection (struct vfs_s_super *super, const char *shutdown_message 
    456454        libssh2_session_disconnect (super_data->session, shutdown_message); 
    457455        super_data->session = NULL; 
    458456    } 
    459     if (super_data->fingerprint != NULL) 
    460         super_data->fingerprint = NULL; 
     457 
     458    super_data->fingerprint = NULL; 
    461459 
    462460    if (super_data->socket_handle != -1) 
    463461    {