From owner-svn-src-head@FreeBSD.ORG Fri Sep 6 23:49:55 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 0FAAFD0; Fri, 6 Sep 2013 23:49:55 +0000 (UTC) (envelope-from jilles@FreeBSD.org) 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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F150F27E6; Fri, 6 Sep 2013 23:49:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r86Nns8t083626; Fri, 6 Sep 2013 23:49:54 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r86Nnss8083625; Fri, 6 Sep 2013 23:49:54 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201309062349.r86Nnss8083625@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 6 Sep 2013 23:49:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255336 - head/lib/libc/resolv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Sep 2013 23:49:55 -0000 Author: jilles Date: Fri Sep 6 23:49:54 2013 New Revision: 255336 URL: http://svnweb.freebsd.org/changeset/base/255336 Log: libc: Make resolver sockets close-on-exec (SOCK_CLOEXEC). Although the resolver's sockets are exposed to applications via res_state, I do not expect them to pass the sockets across execve(). Modified: head/lib/libc/resolv/res_send.c Modified: head/lib/libc/resolv/res_send.c ============================================================================== --- head/lib/libc/resolv/res_send.c Fri Sep 6 23:47:50 2013 (r255335) +++ head/lib/libc/resolv/res_send.c Fri Sep 6 23:49:54 2013 (r255336) @@ -660,7 +660,8 @@ send_vc(res_state statp, if (statp->_vcsock >= 0) res_nclose(statp); - statp->_vcsock = _socket(nsap->sa_family, SOCK_STREAM, 0); + statp->_vcsock = _socket(nsap->sa_family, SOCK_STREAM | + SOCK_CLOEXEC, 0); #if !defined(USE_POLL) && !defined(USE_KQUEUE) if (statp->_vcsock > highestFD) { res_nclose(statp); @@ -851,7 +852,7 @@ send_dg(res_state statp, nsaplen = get_salen(nsap); if (EXT(statp).nssocks[ns] == -1) { EXT(statp).nssocks[ns] = _socket(nsap->sa_family, - SOCK_DGRAM, 0); + SOCK_DGRAM | SOCK_CLOEXEC, 0); #if !defined(USE_POLL) && !defined(USE_KQUEUE) if (EXT(statp).nssocks[ns] > highestFD) { res_nclose(statp);