*/
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];
struct sftp_packet *sftp_recv(void) {
struct sftp_packet *pkt;
char x[4];
- int p, ret;
if (!sftp_recvdata(x, 4))
return NULL;
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;
return NULL;
}
if (pktin->type == SSH_FXP_HANDLE) {
- int count;
char *hstring;
struct fxp_handle *handle;
int len;
return NULL;
}
if (pktin->type == SSH_FXP_HANDLE) {
- int count;
char *hstring;
struct fxp_handle *handle;
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;