summaryrefslogtreecommitdiff
path: root/lib/util
diff options
context:
space:
mode:
authorAndreas Schneider <asn@redhat.com>2010-03-26 11:17:37 +0100
committerAndreas Schneider <asn@redhat.com>2010-03-26 14:48:54 +0100
commita6f25fc635dce0b67422b271e09467e9ea854489 (patch)
tree7163e806229de11106198ec1eefc569f0cd384a0 /lib/util
parentf70e1b4d43995ac4c7ab020613d3f0af24eb03f6 (diff)
downloadsamba-a6f25fc635dce0b67422b271e09467e9ea854489.tar.gz
s3-smbd: Don't close stdout if we want to log to stdout.
Diffstat (limited to 'lib/util')
-rw-r--r--lib/util/become_daemon.c10
-rw-r--r--lib/util/util.h2
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/util/become_daemon.c b/lib/util/become_daemon.c
index 3d06a4363df..2af16316b53 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 b89a7d60508..8383344cd5f 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.