[Samba] [BUG] Samba 3.0.11: nmbd forgets to close stderr
Denis Zaitsev
zzz at anda.ru
Mon Mar 28 18:43:11 GMT 2005
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.
More information about the samba
mailing list