Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 May 2015 10:33:34 +0000 (UTC)
From:      Tony Finch <fanf@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r282888 - head/usr.bin/whois
Message-ID:  <201505141033.t4EAXYll039281@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: fanf
Date: Thu May 14 10:33:33 2015
New Revision: 282888
URL: https://svnweb.freebsd.org/changeset/base/282888

Log:
  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.

Modified:
  head/usr.bin/whois/whois.c

Modified: head/usr.bin/whois/whois.c
==============================================================================
--- head/usr.bin/whois/whois.c	Thu May 14 10:33:01 2015	(r282887)
+++ head/usr.bin/whois/whois.c	Thu May 14 10:33:33 2015	(r282888)
@@ -311,7 +311,7 @@ whois(const char *query, const char *hos
 	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()");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505141033.t4EAXYll039281>