Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Oct 2011 11:49:14 +0000 (UTC)
From:      Dag-Erling Smorgrav <des@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r226539 - stable/8/lib/libfetch
Message-ID:  <201110191149.p9JBnEK6023245@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: des
Date: Wed Oct 19 11:49:14 2011
New Revision: 226539
URL: http://svn.freebsd.org/changeset/base/226539

Log:
  MFH r221830: mark all sockets and file descriptors close-on-exec
  
  PR:		bin/151866

Modified:
  stable/8/lib/libfetch/common.c
  stable/8/lib/libfetch/file.c
Directory Properties:
  stable/8/lib/libfetch/   (props changed)

Modified: stable/8/lib/libfetch/common.c
==============================================================================
--- stable/8/lib/libfetch/common.c	Wed Oct 19 11:48:21 2011	(r226538)
+++ stable/8/lib/libfetch/common.c	Wed Oct 19 11:49:14 2011	(r226539)
@@ -213,6 +213,7 @@ fetch_reopen(int sd)
 	/* allocate and fill connection structure */
 	if ((conn = calloc(1, sizeof(*conn))) == NULL)
 		return (NULL);
+	fcntl(sd, F_SETFD, FD_CLOEXEC);
 	conn->sd = sd;
 	++conn->ref;
 	return (conn);

Modified: stable/8/lib/libfetch/file.c
==============================================================================
--- stable/8/lib/libfetch/file.c	Wed Oct 19 11:48:21 2011	(r226538)
+++ stable/8/lib/libfetch/file.c	Wed Oct 19 11:49:14 2011	(r226539)
@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/stat.h>
 
 #include <dirent.h>
+#include <fcntl.h>
 #include <stdio.h>
 #include <string.h>
 
@@ -57,6 +58,7 @@ fetchXGetFile(struct url *u, struct url_
 		fetch_syserr();
 	}
 
+	fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
 	return (f);
 }
 
@@ -84,6 +86,7 @@ fetchPutFile(struct url *u, const char *
 		fetch_syserr();
 	}
 
+	fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
 	return (f);
 }
 



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