diff --git a/src/sftp.c b/src/sftp.c index 7feae32f..82daa4b9 100644 --- a/src/sftp.c +++ b/src/sftp.c @@ -1677,10 +1677,11 @@ static ssize_t sftp_write(LIBSSH2_SFTP_HANDLE *handle, const char *buffer, chunk = next; } - else { - /* TODO: handle errors here! */ - break; - } + else + /* the server returned an error for that written chunk, propagate + this back to our parent function */ + return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL, + "FXP write failed"); } /* if there were acked data in a previous call that wasn't returned then,