sftp_write: handle FXP_WRITE errors

When an sftp server returns an error back on write, make sure the
function bails out and returns the proper error.
This commit is contained in:
Daniel Stenberg 2011-03-30 11:35:37 +02:00
parent 8c9571b7ba
commit 2e352d3085

View File

@ -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,