adjust read on SFTP get

pull/134/head
Jacob Barthelmeh 2019-01-02 13:31:20 -07:00
parent f0ba3a0849
commit 887b4fa3ba
1 changed files with 5 additions and 1 deletions

View File

@ -5135,6 +5135,10 @@ int wolfSSH_SFTP_Get(WOLFSSH* ssh, char* from,
state->handle, state->handleSz,
state->gOfst, state->r,
WOLFSSH_MAX_SFTP_RW);
if (wolfSSH_get_error(ssh) == WS_WANT_READ) {
return WS_FATAL_ERROR;
}
if (sz > 0) {
if ((long)WFWRITE(state->r, 1,
sz, state->fl) != sz) {
@ -5148,7 +5152,7 @@ int wolfSSH_SFTP_Get(WOLFSSH* ssh, char* from,
}
}
} while (sz > 0 && ssh->sftpInt == 0);
if (ret != WS_SUCCESS) {
if (sz < 0) {
state->state = STATE_GET_CLEANUP;
continue;
}