X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/4a8fc3c43e71f1500b1f1203431ce944a832110e..d8770b1245ff0acd81f581c5667563e0d127104a:/sftp.c diff --git a/sftp.c b/sftp.c index abd940a4..792678e6 100644 --- a/sftp.c +++ b/sftp.c @@ -99,7 +99,7 @@ static void sftp_pkt_addstring(struct sftp_packet *pkt, char *data) { */ static unsigned char sftp_pkt_getbyte(struct sftp_packet *pkt) { - unsigned long value; + unsigned char value; if (pkt->length - pkt->savedpos < 1) return 0; /* arrgh, no way to decline (FIXME?) */ value = (unsigned char) pkt->data[pkt->savedpos]; @@ -182,7 +182,6 @@ int sftp_send(struct sftp_packet *pkt) { struct sftp_packet *sftp_recv(void) { struct sftp_packet *pkt; char x[4]; - int p, ret; if (!sftp_recvdata(x, 4)) return NULL; @@ -286,6 +285,10 @@ int fxp_init(void) { 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; @@ -368,7 +371,6 @@ struct fxp_handle *fxp_open(char *path, int type) { return NULL; } if (pktin->type == SSH_FXP_HANDLE) { - int count; char *hstring; struct fxp_handle *handle; int len; @@ -407,7 +409,6 @@ struct fxp_handle *fxp_opendir(char *path) { return NULL; } if (pktin->type == SSH_FXP_HANDLE) { - int count; char *hstring; struct fxp_handle *handle; int len; @@ -553,7 +554,7 @@ int fxp_write(struct fxp_handle *handle, char *buffer, uint64 offset, int len) { id = sftp_pkt_getuint32(pktin); if (id != 0xDCB) { fxp_internal_error("request ID mismatch\n"); - return NULL; + return 0; } fxp_got_status(pktin); return fxp_errtype == SSH_FX_OK;