On Jan 10, 2012, at 5:06 PM, Jilles Tjoelker wrote:

> 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

Good idea, thanks!

Guy


--------
This message has been scanned by ComplianceSafe, powered by Palisade's 
PacketSure.
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to