mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
Windows handle sockets: fix error handling in sentdata().
In the sentdata callback function given to handle_output_new, the 'new_backlog' parameter can be negative, and if so, it represents a Windows error code and not a backlog size at all. handle_sentdata was not checking for this before passing it on to plug_sent.
This commit is contained in:
parent
86b604dd65
commit
51732faeb9
@ -94,7 +94,15 @@ static int handle_stderr(struct handle *h, void *data, int len)
|
|||||||
static void handle_sentdata(struct handle *h, int new_backlog)
|
static void handle_sentdata(struct handle *h, int new_backlog)
|
||||||
{
|
{
|
||||||
Handle_Socket ps = (Handle_Socket) handle_get_privdata(h);
|
Handle_Socket ps = (Handle_Socket) handle_get_privdata(h);
|
||||||
|
|
||||||
|
if (new_backlog < 0) {
|
||||||
|
/* Special case: this is actually reporting an error writing
|
||||||
|
* to the underlying handle, and our input value is the error
|
||||||
|
* code itself, negated. */
|
||||||
|
plug_closing(ps->plug, win_strerror(-new_backlog), -new_backlog, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
plug_sent(ps->plug, new_backlog);
|
plug_sent(ps->plug, new_backlog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user