mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
Mark all socket and file descriptors close-on-exec.
PR: bin/151866 MFC after: 3 weeks
This commit is contained in:
parent
3d08a76bbc
commit
15b68c63bb
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=221830
|
@ -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);
|
||||
|
|
|
@ -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_stat *us, const char *flags)
|
|||
fetch_syserr();
|
||||
}
|
||||
|
||||
fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
|
||||
return (f);
|
||||
}
|
||||
|
||||
|
@ -84,6 +86,7 @@ fetchPutFile(struct url *u, const char *flags)
|
|||
fetch_syserr();
|
||||
}
|
||||
|
||||
fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
|
||||
return (f);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue