From owner-svn-src-all@FreeBSD.ORG Thu May 14 10:33:34 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 730424BD; Thu, 14 May 2015 10:33:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 627BD1FD9; Thu, 14 May 2015 10:33:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4EAXYkm039282; Thu, 14 May 2015 10:33:34 GMT (envelope-from fanf@FreeBSD.org) Received: (from fanf@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4EAXYll039281; Thu, 14 May 2015 10:33:34 GMT (envelope-from fanf@FreeBSD.org) Message-Id: <201505141033.t4EAXYll039281@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: fanf set sender to fanf@FreeBSD.org using -f From: Tony Finch Date: Thu, 14 May 2015 10:33:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282888 - head/usr.bin/whois X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2015 10:33:34 -0000 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()");