svn commit: r226539 - stable/8/lib/libfetch
Dag-Erling Smorgrav
des at FreeBSD.org
Wed Oct 19 11:49:14 UTC 2011
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);
}
More information about the svn-src-stable
mailing list