Merge pull request #102 from JacobBarthelmeh/sftp

break out of "put" loop if at end of file or error
pull/104/head
John Safranek 2018-09-11 16:16:34 -07:00 committed by GitHub
commit 172c5fd749
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -4247,6 +4247,9 @@ int wolfSSH_SFTP_Put(WOLFSSH* ssh, char* from, char* to, byte resume,
ret = WS_SUCCESS; ret = WS_SUCCESS;
do { do {
rSz = (int)WFREAD(r, 1, WOLFSSH_MAX_SFTP_RW, fl); rSz = (int)WFREAD(r, 1, WOLFSSH_MAX_SFTP_RW, fl);
if (rSz <= 0 ) {
break; /* either at end of file or error */
}
sz = wolfSSH_SFTP_SendWritePacket(ssh, handle, handleSz, pOfst, sz = wolfSSH_SFTP_SendWritePacket(ssh, handle, handleSz, pOfst,
r, rSz); r, rSz);
if (sz > 0) { if (sz > 0) {