diff options
author | fanf <fanf@FreeBSD.org> | 2015-05-14 10:33:33 +0000 |
---|---|---|
committer | fanf <fanf@FreeBSD.org> | 2015-05-14 10:33:33 +0000 |
commit | 18c4720eeff4609b1ac439e75893886f7f49ba17 (patch) | |
tree | 8e2430c951c6f663a55d5c7e7988053b9d2356d8 /usr.bin/whois | |
parent | 8fd803db87b4bc0d3dc916d6cf70337c3a0ac9a4 (diff) | |
download | FreeBSD-src-18c4720eeff4609b1ac439e75893886f7f49ba17.zip FreeBSD-src-18c4720eeff4609b1ac439e75893886f7f49ba17.tar.gz |
whois: do not clobber command-line flags when tweaking O_NONBLOCK
This can make whois fail to follow referrals when it should.
The bug was introduced in r281959.
Diffstat (limited to 'usr.bin/whois')
-rw-r--r-- | usr.bin/whois/whois.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/whois/whois.c b/usr.bin/whois/whois.c index 9fdd007..824138c 100644 --- a/usr.bin/whois/whois.c +++ b/usr.bin/whois/whois.c @@ -311,7 +311,7 @@ whois(const char *query, const char *hostname, int flags) FILE *fp; struct addrinfo *hostres, *res; char *buf, *host, *nhost, *p; - int s = -1; + int s = -1, f; nfds_t i, j; size_t c, len, count; struct pollfd *fds; @@ -431,9 +431,9 @@ done: if (s != -1) { /* Restore default blocking behavior. */ - if ((flags = fcntl(s, F_GETFL)) != -1) { - flags &= ~O_NONBLOCK; - if (fcntl(s, F_SETFL, flags) == -1) + if ((f = fcntl(s, F_GETFL)) != -1) { + f &= ~O_NONBLOCK; + if (fcntl(s, F_SETFL, f) == -1) err(EX_OSERR, "fcntl()"); } else err(EX_OSERR, "fcntl()"); |