1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-04-17 19:18:06 -05:00
Simon Tatham eccd4bf781 pollwrap: stop returning unasked-for rwx statuses.
The sets of poll(2) events that we check in order to return SELECT_R
and SELECT_W overlap: to be precise, they have POLLERR in common. So
if an fd signals POLLERR, then pollwrap_get_fd_rwx will respond by
saying that it has both SELECT_R and SELECT_W available on it - even
if the caller had only asked for one of those.

In other words, you can get a spurious SELECT_W notification on an fd
that you never asked for SELECT_W on in the first place. This
definitely isn't what I'd meant that API to do.

In particular, if a socket in the middle of an asynchronous connect()
signals POLLERR, then Unix Plink will call select_result for it with
SELECT_R and then SELECT_W respectively. The former will notice that
it's got an error condition and call plug_closing - and _then_ the
latter will decide that it's writable and set s->connected! The plan
was to only select it for write until it was connected, but this bug
in pollwrap was defeating that plan.

Now pollwrap_get_fd_rwx should only ever return a set of rwx flags
that's a subset of the one that the client asked for via
pollwrap_add_fd_rwx.

(cherry picked from commit 78974fce896068b099cfc99ac7be27d5fe3bb075)
2020-06-14 15:49:36 +01:00
..
2020-02-09 08:51:37 +00:00
2019-03-31 10:35:10 +01:00
2019-10-14 19:42:37 +01:00
2020-02-09 08:51:37 +00:00
2020-02-09 08:51:37 +00:00
2019-10-14 19:42:37 +01:00
2019-10-14 19:42:37 +01:00
2019-10-14 19:42:37 +01:00
2019-10-14 19:42:37 +01:00
2020-02-09 08:51:37 +00:00