]> asedeno.scripts.mit.edu Git - PuTTY.git/commit - unix/uxproxy.c
Avoid passing -1 as an fd to uxsel_set().
authorSimon Tatham <anakin@pobox.com>
Wed, 25 Nov 2015 18:18:45 +0000 (18:18 +0000)
committerSimon Tatham <anakin@pobox.com>
Wed, 25 Nov 2015 18:18:45 +0000 (18:18 +0000)
commit6c9aa9be32a44d1b2ffd02d211e6e76ec328ee76
tree051e97a5b7a21fea74346ac44bc4e54b63c08896
parent50d73d95dacb1f9003151f226552e38cdcbb657b
Avoid passing -1 as an fd to uxsel_set().

I'd missed out an if statement in the Unix proxy stderr code
introduced by commit 297efff30, causing ret->cmd_err to be passed to
uxsel_set even when it was -1 (which happened in the non-GUI tools).
Unfortunately, putting a negative fd into the uxsel tree has really
bad effects, because the first_fd / next_fd interface returns a
negative number to signal end-of-list - and since the uxsel tree is
sorted by fd, that happens _immediately_.

Added the missing if statement, and also an assertion to make sure we
never pass -1 to uxsel_set by mistake again!
unix/uxproxy.c
unix/uxsel.c