set ssh error in sftp status not ok state

pull/487/head
JacobBarthelmeh 2023-01-16 09:31:31 -08:00
parent 834a03ce84
commit cb4a50a764
2 changed files with 16 additions and 0 deletions

View File

@ -86,6 +86,16 @@ then
exit 1
fi
# Test fail on file that does not exist
rm -rf sample1-does-not-exist
if ./examples/sftpclient/wolfsftp -u jill -P upthehill -p "$PORT" \
-G -l sample1-copy.txt -r sample1-does-not-exist
then
echo "Success when expecting fail to get file."
do_cleanup
exit 1
fi
# Put test.
if ! ./examples/sftpclient/wolfsftp -u jill -P upthehill -p "$PORT" \
-g -l sample2.txt -r sample2-copy.txt

View File

@ -5302,6 +5302,12 @@ static int wolfSSH_SFTP_DoStatus(WOLFSSH* ssh, word32 reqId,
}
wolfSSH_SFTP_buffer_seek(buffer, 0, localIdx);
if (status != WOLFSSH_FTP_OK &&
ssh->error != WS_WANT_READ && ssh->error != WS_WANT_WRITE) {
/* set ssh error as the SFTP status not being ok */
ssh->error = WS_SFTP_STATUS_NOT_OK;
}
return status;
}