summaryrefslogtreecommitdiffstats
path: root/source/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-06-18 11:53:52 +0200
committerKarolin Seeger <kseeger@samba.org>2009-07-27 15:55:08 +0200
commit4b4b8c34ef9b0d334537928ac26870f9fcb7775a (patch)
treed5108e374361a2c6bd565790bcb35a2c935efd2b /source/smbd
parent81e9fb11e548245d8d57f85db69d56c72dd4cfab (diff)
downloadsamba-4b4b8c34ef9b0d334537928ac26870f9fcb7775a.tar.gz
samba-4b4b8c34ef9b0d334537928ac26870f9fcb7775a.tar.xz
samba-4b4b8c34ef9b0d334537928ac26870f9fcb7775a.zip
Fix bug #6476 - more then 3000 smbd-zombies in memory
We weren't reaping children in the [x]inetd case. Jeremy. (cherry picked from commit 7e51314f2e18241876b049642fcb133df7e44c70)
Diffstat (limited to 'source/smbd')
-rw-r--r--source/smbd/server.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/source/smbd/server.c b/source/smbd/server.c
index 2415aebabc3..e0f86a6b7ca 100644
--- a/source/smbd/server.c
+++ b/source/smbd/server.c
@@ -355,10 +355,6 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_
struct dns_reg_state * dns_reg = NULL;
unsigned dns_port = 0;
- if (!is_daemon) {
- return open_sockets_inetd();
- }
-
#ifdef HAVE_ATEXIT
{
static int atexit_set;
@@ -369,6 +365,17 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_
}
#endif
+ if (!is_daemon) {
+ /*
+ * Stop zombies the old way.
+ * We aren't forking any new
+ * 'normal' connections when
+ * run from [x]inetd.
+ */
+ CatchChild();
+ return open_sockets_inetd();
+ }
+
/* Stop zombies */
CatchSignal(SIGCLD, sig_cld);
@@ -1252,6 +1259,10 @@ extern void build_options(bool screen);
BlockSignals(False, SIGUSR1);
BlockSignals(False, SIGTERM);
+ /* Ensure we leave no zombies until we
+ * correctly set up child handling below. */
+ CatchChild();
+
/* we want total control over the permissions on created files,
so set our umask to 0 */
umask(0);