whois(1): Fix potential double-close and logic mistakes
authorcem <cem@FreeBSD.org>
Wed, 11 May 2016 18:03:51 +0000 (18:03 +0000)
committercem <cem@FreeBSD.org>
Wed, 11 May 2016 18:03:51 +0000 (18:03 +0000)
commit8093b741c766ae4c82afcd7999ff372061614b25
tree789183b44bad419bca19794b385f787d0504459d
parentabcd904de95284bcf552a1a1c58de9ddf48a5bd7
whois(1): Fix potential double-close and logic mistakes

Close the fd the poll error was detected on, rather than the last opened fd, to
fix the double-close.

Use -1 to make it explict which int variables no longer own socket file
descriptors.

Actually shrink, rather than grow, the poll timeout to match comment.

Reported by: Coverity
CID: 1304860, 1305616
Sponsored by: EMC / Isilon Storage Division
usr.bin/whois/whois.c