sftp_write: flush the packetlist on error
When an error occurs during write, flush the entire list of pending outgoing SFTP packets.
This commit is contained in:
parent
78498e0588
commit
9f477073bc
@ -1,6 +1,6 @@
|
|||||||
/* Copyright (c) 2004-2008, Sara Golemon <sarag@libssh2.org>
|
/* Copyright (c) 2004-2008, Sara Golemon <sarag@libssh2.org>
|
||||||
* Copyright (c) 2007 Eli Fant <elifantu@mail.ru>
|
* Copyright (c) 2007 Eli Fant <elifantu@mail.ru>
|
||||||
* Copyright (c) 2009-2010 by Daniel Stenberg
|
* Copyright (c) 2009-2011 by Daniel Stenberg
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms,
|
* Redistribution and use in source and binary forms,
|
||||||
@ -1677,12 +1677,16 @@ static ssize_t sftp_write(LIBSSH2_SFTP_HANDLE *handle, const char *buffer,
|
|||||||
|
|
||||||
chunk = next;
|
chunk = next;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
|
/* flush all pending packets from the outgoing list */
|
||||||
|
sftp_packetlist_flush(handle);
|
||||||
|
|
||||||
/* the server returned an error for that written chunk, propagate
|
/* the server returned an error for that written chunk, propagate
|
||||||
this back to our parent function */
|
this back to our parent function */
|
||||||
return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
|
return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL,
|
||||||
"FXP write failed");
|
"FXP write failed");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* if there were acked data in a previous call that wasn't returned then,
|
/* if there were acked data in a previous call that wasn't returned then,
|
||||||
add that up and try to return it all now. This can happen if the app
|
add that up and try to return it all now. This can happen if the app
|
||||||
|
Loading…
Reference in New Issue
Block a user