1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

uxproxy: fix write error handling on outgoing pipe.

Jacob pointed out the other day that the call to logevent with NULL
frontend handle can't possibly work, and the comment next to it saying
that it can is an outright lie (probably thoughtlessly copied from
some part of the Windows front end, where it actually would be true).
Furthermore, even if that logevent call didn't dereference NULL and
segfault, the followup call to fatalbox() would be inappropriate,
since proxied connections need not be the primary network connection
of the whole process.

Rewritten as a call to plug_closing, which is the proper channel
through which to report errors on an individual socket or equivalent.
This commit is contained in:
Simon Tatham 2017-02-22 21:51:03 +00:00
parent 9ce982622f
commit 86b604dd65

View File

@ -149,10 +149,8 @@ static int localproxy_try_send(Local_Proxy_Socket ps)
bufchain_prefix(&ps->pending_output_data, &data, &len);
ret = write(ps->to_cmd, data, len);
if (ret < 0 && errno != EWOULDBLOCK) {
/* We're inside the Unix frontend here, so we know
* that the frontend handle is unnecessary. */
logevent(NULL, strerror(errno));
fatalbox("%s", strerror(errno));
plug_closing(ps->plug, strerror(errno), errno, 0);
return 0;
} else if (ret <= 0) {
break;
} else {