diff options
author | Andrew Bartlett <abartlet@samba.org> | 2008-06-27 12:03:23 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2008-06-27 12:03:23 +1000 |
commit | 7a295c66c056bc6eeb26d2176584fff4152b90b8 (patch) | |
tree | 6d18c2cb68f89f36e8085689e282fbf1cbc3e95f /source4/smbd/server.c | |
parent | 1e36856ae50762ebad2d16e81b7ad604509b0d52 (diff) | |
parent | d4172dac2c122bc2cf5f419d5687168468a9a141 (diff) | |
download | samba-7a295c66c056bc6eeb26d2176584fff4152b90b8.tar.gz samba-7a295c66c056bc6eeb26d2176584fff4152b90b8.tar.xz samba-7a295c66c056bc6eeb26d2176584fff4152b90b8.zip |
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into 4-0-local
(This used to be commit 9607e79c3db9743617397c347bb69f87f6525801)
Diffstat (limited to 'source4/smbd/server.c')
-rw-r--r-- | source4/smbd/server.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/source4/smbd/server.c b/source4/smbd/server.c index 74c87c68a4..5bd5568913 100644 --- a/source4/smbd/server.c +++ b/source4/smbd/server.c @@ -202,6 +202,7 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[ init_module_fn static_init[] = { STATIC_smbd_MODULES }; init_module_fn *shared_init; struct event_context *event_ctx; + uint16_t stdin_event_flags; NTSTATUS status; const char *model = "standard"; int max_runtime = 0; @@ -324,15 +325,20 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[ cluster_ctdb_init(cmdline_lp_ctx, event_ctx, model); if (opt_interactive) { - /* catch EOF on stdin */ -#ifdef SIGTTIN - signal(SIGTTIN, SIG_IGN); -#endif - event_add_fd(event_ctx, event_ctx, 0, EVENT_FD_READ, - server_stdin_handler, - discard_const(binary_name)); + /* terminate when stdin goes away */ + stdin_event_flags = EVENT_FD_READ; + } else { + /* stay alive forever */ + stdin_event_flags = 0; } + /* catch EOF on stdin */ +#ifdef SIGTTIN + signal(SIGTTIN, SIG_IGN); +#endif + event_add_fd(event_ctx, event_ctx, 0, stdin_event_flags, + server_stdin_handler, + discard_const(binary_name)); if (max_runtime) { event_add_timed(event_ctx, event_ctx, |