[SCM] Samba Shared Repository - branch master updated

Andreas Schneider asn at samba.org
Fri Mar 26 07:49:31 MDT 2010


The branch, master has been updated
       via  a6f25fc... s3-smbd: Don't close stdout if we want to log to stdout.
      from  f70e1b4... s4-smbtorture: fail spoolss test on SetJob failure.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit a6f25fc635dce0b67422b271e09467e9ea854489
Author: Andreas Schneider <asn at redhat.com>
Date:   Fri Mar 26 11:17:37 2010 +0100

    s3-smbd: Don't close stdout if we want to log to stdout.

-----------------------------------------------------------------------

Summary of changes:
 lib/util/become_daemon.c    |   10 ++++++----
 lib/util/util.h             |    2 +-
 source3/nmbd/nmbd.c         |    2 +-
 source3/smbd/server.c       |    2 +-
 source3/web/startstop.c     |    6 +++---
 source3/winbindd/winbindd.c |    2 +-
 source4/smbd/server.c       |    2 +-
 7 files changed, 14 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/become_daemon.c b/lib/util/become_daemon.c
index 3d06a43..2af1631 100644
--- a/lib/util/become_daemon.c
+++ b/lib/util/become_daemon.c
@@ -66,7 +66,7 @@ _PUBLIC_ void close_low_fds(bool stderr_too)
  Become a daemon, discarding the controlling terminal.
 ****************************************************************************/
 
-_PUBLIC_ void become_daemon(bool do_fork, bool no_process_group)
+_PUBLIC_ void become_daemon(bool do_fork, bool no_process_group, bool log_stdout)
 {
 	if (do_fork) {
 		if (sys_fork()) {
@@ -87,7 +87,9 @@ _PUBLIC_ void become_daemon(bool do_fork, bool no_process_group)
 	}
 #endif /* HAVE_SETSID */
 
-	/* Close fd's 0,1,2. Needed if started by rsh */
-	close_low_fds(false);  /* Don't close stderr, let the debug system
-				  attach it to the logfile */
+	if (!log_stdout) {
+		/* Close fd's 0,1,2. Needed if started by rsh */
+		close_low_fds(false);  /* Don't close stderr, let the debug system
+					  attach it to the logfile */
+	}
 }
diff --git a/lib/util/util.h b/lib/util/util.h
index b89a7d6..8383344 100644
--- a/lib/util/util.h
+++ b/lib/util/util.h
@@ -827,7 +827,7 @@ _PUBLIC_ void close_low_fds(bool stderr_too);
 /**
  Become a daemon, discarding the controlling terminal.
 **/
-_PUBLIC_ void become_daemon(bool do_fork, bool no_process_group);
+_PUBLIC_ void become_daemon(bool do_fork, bool no_process_group, bool log_stdout);
 
 /**
  * Load a ini-style file.
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 4443dfa..5dc021a 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -889,7 +889,7 @@ static bool open_sockets(bool isdaemon, int port)
   
 	if (is_daemon && !opt_interactive) {
 		DEBUG( 2, ( "Becoming a daemon.\n" ) );
-		become_daemon(Fork, no_process_group);
+		become_daemon(Fork, no_process_group, log_stdout);
 	}
 
 #if HAVE_SETPGID
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index e5cfc27..49e2eda 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1235,7 +1235,7 @@ extern void build_options(bool screen);
 
 	if (is_daemon && !interactive) {
 		DEBUG( 3, ( "Becoming a daemon.\n" ) );
-		become_daemon(Fork, no_process_group);
+		become_daemon(Fork, no_process_group, log_stdout);
 	}
 
 #if HAVE_SETPGID
diff --git a/source3/web/startstop.c b/source3/web/startstop.c
index b24410a..81350e6 100644
--- a/source3/web/startstop.c
+++ b/source3/web/startstop.c
@@ -36,7 +36,7 @@ void start_smbd(void)
 	}
 
 	if (asprintf(&binfile, "%s/smbd", get_dyn_SBINDIR()) > 0) {
-		become_daemon(true, false);
+		become_daemon(true, false, false);
 		execl(binfile, binfile, "-D", NULL);
 	}
 	exit(0);
@@ -56,7 +56,7 @@ void start_nmbd(void)
 	}
 
 	if (asprintf(&binfile, "%s/nmbd", get_dyn_SBINDIR()) > 0) {
-		become_daemon(true, false);
+		become_daemon(true, false, false);
 		execl(binfile, binfile, "-D", NULL);
 	}
 	exit(0);
@@ -76,7 +76,7 @@ void start_winbindd(void)
 	}
 
 	if (asprintf(&binfile, "%s/winbindd", get_dyn_SBINDIR()) > 0) {
-		become_daemon(true, false);
+		become_daemon(true, false, false);
 		execl(binfile, binfile, NULL);
 	}
 	exit(0);
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index b04fd5d..86304e9 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -1185,7 +1185,7 @@ int main(int argc, char **argv, char **envp)
 	BlockSignals(False, SIGCHLD);
 
 	if (!interactive)
-		become_daemon(Fork, no_process_group);
+		become_daemon(Fork, no_process_group, log_stdout);
 
 	pidfile_create("winbindd");
 
diff --git a/source4/smbd/server.c b/source4/smbd/server.c
index 83f6e7d..a09da3c 100644
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -336,7 +336,7 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[
 
 	if (opt_daemon) {
 		DEBUG(3,("Becoming a daemon.\n"));
-		become_daemon(true, false);
+		become_daemon(true, false, false);
 	}
 
 	cleanup_tmp_files(cmdline_lp_ctx);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list