[Samba] [BUG] Samba 3.0.11: nmbd forgets to close stderr

John H Terpstra jht at samba.org
Tue Mar 29 00:33:39 GMT 2005


On Monday 28 March 2005 11:43, Denis Zaitsev wrote:
> To start all the daemons in my Linuxes I use the code like:
>
>         errtext=`daemon 2>&1`
>         if [ $? -ne 0 ]; do smth. with errtext too...
>
> And this used to work for Samba as well.  But for 3.0.11 (and very
> probably not only for this release) this code doesn't work for nmbd:
> `nmbd 2>&1` freezes forever.  But the daemon is started and works at
> the same time.  And the shell gives the control back only after the
> daemon is stopped.  This looks like nmbd holds stderr opened after
> fork or so.  Then, this dummy patch cures all the things back:
>
>
> --- nmbd/nmbd.c
> +++ nmbd/nmbd.c
> @@ -766,6 +766,7 @@ static BOOL open_sockets(BOOL isdaemon,
>  	/* We can only take signals in the select. */
>  	BlockSignals( True, SIGTERM );
>
> +	close(2);
>  	process();
>
>  	if (dbf)
>
>
> So, this confirms that stderr is left opened by the daemon.
>
> I can't say when this bug has arisen exactly.  All I know is that it
> does not present in 3.0.4 and presents in 3.0.11.

Please post this as a bug report on https://bugzilla.samba.org - that way it 
will get fixed.

- John T.
-- 
John H Terpstra
Samba-Team Member
Phone: +1 (650) 580-8668

Author:
The Official Samba-3 HOWTO & Reference Guide, ISBN: 0131453556
Samba-3 by Example, ISBN: 0131472216
Hardening Linux, ISBN: 0072254971
Other books in production.


More information about the samba mailing list