Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Sep 2013 23:49:54 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r255336 - head/lib/libc/resolv
Message-ID:  <201309062349.r86Nnss8083625@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



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