summaryrefslogtreecommitdiff
path: root/lib/util/become_daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util/become_daemon.c')
-rw-r--r--lib/util/become_daemon.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/util/become_daemon.c b/lib/util/become_daemon.c
index 3d06a4363d..2af16316b5 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 */
+ }
}