svn commit: r229936 - head/lib/libutil
Guy Helmer
guy.helmer at palisadesystems.com
Wed Jan 11 16:36:44 UTC 2012
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.
More information about the svn-src-head
mailing list