Index: psftp.c ================================================================== --- psftp.c +++ psftp.c @@ -588,10 +588,11 @@ */ if (!fxp_init()) { fprintf(stderr, "Fatal: unable to initialise SFTP: %s\n", fxp_error()); + return; } /* * Find out where our home directory is. */ Index: sftp.c ================================================================== --- sftp.c +++ sftp.c @@ -284,10 +284,14 @@ pktout = sftp_pkt_init(SSH_FXP_INIT); sftp_pkt_adduint32(pktout, SFTP_PROTO_VERSION); sftp_send(pktout); pktin = sftp_recv(); + if (!pktin) { + fxp_internal_error("could not connect"); + return 0; + } if (pktin->type != SSH_FXP_VERSION) { fxp_internal_error("did not receive FXP_VERSION"); return 0; } remotever = sftp_pkt_getuint32(pktin);