svn commit: r229936 - head/lib/libutil
Jilles Tjoelker
jilles at stack.nl
Tue Jan 10 23:06:10 UTC 2012
On Tue, Jan 10, 2012 at 06:43:27PM +0000, Guy Helmer wrote:
> Author: ghelmer
> Date: Tue Jan 10 18:43:27 2012
> New Revision: 229936
> URL: http://svn.freebsd.org/changeset/base/229936
> Log:
> Set the FD_CLOEXEC flag on the open pidfile file descriptor.
> Discussed with: pjd, des
> Modified:
> head/lib/libutil/pidfile.c
> + /*
> + * Prevent the file descriptor from escaping to other
> + * programs via exec(3).
> + */
> + if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) {
Consider adding O_CLOEXEC to the flopen() flags instead. That saves a
system call and removes a possible race condition with fork/exec from
threads or signal handlers.
--
Jilles Tjoelker
More information about the svn-src-head
mailing list