Using close on exec in tdb

James Peach jpeach at samba.org
Mon Sep 24 19:44:22 GMT 2007


On Sep 24, 2007, at 12:31 PM, simo wrote:

>
> It seem we don;t set close on exec on tdb files despite the fact  
> that we
> do fork+exec in many case (preexec, root prexec, various scripts and
> commands we launch).
>
> The attached patch would set close on exec on every tdb we use in  
> samba
> and utilities.
>
> As far as I know there is no case where we rely on an executed process
> to inherit tdb file descriptors.
>
> If this is ok I'd like to apply this patch to all trees.


Does libreplace guarantee to provide FD_CLOEXEC? Some systems (Darwin  
for one) don't have FD_CLOEXEC, but describe F_SETFD like this:

      F_SETFD            Set the close-on-exec flag associated with  
fildes to
                         the low order bit of arg (0 or 1 as above).

So in this case it is safe to "#define FD_CLOEXEC 1".

--
James Peach | jpeach at samba.org



More information about the samba-technical mailing list