From b07d504ca4e476d492beb5552344070e4f96464a Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 2 Mar 2012 19:32:56 +1100 Subject: change low FDs are handled in Samba We now only close fds 0, 1, 2 when we are a forked daemon, and take care not to close a file descriptor that we might need for foreground stdin monitoring. This should fix stdout logging in the lsa and epmapper deamons (ie in make test). Andrew Bartlett --- source3/smbd/server.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 0fb7d16ef6..cab23bc6d5 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -504,12 +504,6 @@ static void smbd_accept_connection(struct tevent_context *ev, * them, counting worker smbds. */ CatchChild(); - /* close our standard file - descriptors */ - if (!debug_get_output_is_stdout()) { - close_low_fds(False); /* Don't close stderr */ - } - status = reinit_after_fork(msg_ctx, ev, true); @@ -1397,10 +1391,8 @@ extern void build_options(bool screen); goes away */ smbd_server_conn->sock = dup(0); - /* close our standard file descriptors */ - if (!debug_get_output_is_stdout()) { - close_low_fds(False); /* Don't close stderr */ - } + /* close stdin, stdout (if not logging to it), but not stderr */ + close_low_fds(true, !debug_get_output_is_stdout(), false); #ifdef HAVE_ATEXIT atexit(killkids); -- cgit