Re: close filedescriptors of children

2018-03-08 Thread Gerhard Roth
If proc_init() knows about debug mode, we can move the call to daemon(3) into proc_init(). Then only the parent calls daemon(3). The children will inherit stdin/out/err from the parent and don't have to do anything. And since the children don't call daemon(3) themselves anymore, there won't be any

Re: close filedescriptors of children

2018-03-07 Thread Damien Miller
On Wed, 7 Mar 2018, Gerhard Roth wrote: > Below is an updated patch that includes proc.c of switchd and vmd. > It also passes the 'debug' flag to proc_init() so that it won't touch > std* in that case. FWIW sshd unconditionally clobbers stdin and stdout and will also clobber stderr if the debug f

Re: close filedescriptors of children

2018-03-07 Thread Mike Belopuhov
On 7 March 2018 at 17:27, Gerhard Roth wrote: > > On Wed, 7 Mar 2018 17:20:06 +0100 Mike Belopuhov wrote: > > On 7 March 2018 at 17:01, Gerhard Roth wrote: > > > > > > Hi Benno, > > > > > > thanks for your reply. > > > > > > On Wed, 7 Mar 2018 15:22:28 +0100 Sebastian Benoit > > wrote: > > > >

Re: close filedescriptors of children

2018-03-07 Thread Gerhard Roth
On Wed, 7 Mar 2018 17:20:06 +0100 Mike Belopuhov wrote: > On 7 March 2018 at 17:01, Gerhard Roth wrote: > > > > Hi Benno, > > > > thanks for your reply. > > > > On Wed, 7 Mar 2018 15:22:28 +0100 Sebastian Benoit > wrote: > > > Hi, > > > > > > switchd and vmd use the same proc.c,and should stay

Re: close filedescriptors of children

2018-03-07 Thread Mike Belopuhov
On 7 March 2018 at 17:01, Gerhard Roth wrote: > > Hi Benno, > > thanks for your reply. > > On Wed, 7 Mar 2018 15:22:28 +0100 Sebastian Benoit wrote: > > Hi, > > > > switchd and vmd use the same proc.c,and should stay in sync. > > Ack. I missed them. > iked also uses proc.c. I think you've got al

Re: close filedescriptors of children

2018-03-07 Thread Gerhard Roth
Hi Benno, thanks for your reply. On Wed, 7 Mar 2018 15:22:28 +0100 Sebastian Benoit wrote: > Hi, > > switchd and vmd use the same proc.c,and should stay in sync. Ack. I missed them. > > Also, this breaks -dvv (i.e. debug output when running inthe foreground), > at least for relayd. Stupid

Re: close filedescriptors of children

2018-03-07 Thread Sebastian Benoit
Hi, switchd and vmd use the same proc.c,and should stay in sync. Also, this breaks -dvv (i.e. debug output when running inthe foreground), at least for relayd. /Benno Gerhard Roth(gerhard_r...@genua.de) on 2018.03.07 13:43:05 +0100: > Hi, > > proc_init() is done before daemon() and for the chi

close filedescriptors of children

2018-03-07 Thread Gerhard Roth
Hi, proc_init() is done before daemon() and for the child processes of httpd, relayd and snmpd() this function never returns. That means that the children inherit stdin, stdout, and stderr of the caller and never close them. This fix this, proc_init() should map these filedes to /dev/null for a c