dovecot-2.0: master: Change stderr to /dev/null just before fork...

dovecot at dovecot.org dovecot at dovecot.org
Thu Feb 10 03:03:34 EET 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/08e4280e5bfd
changeset: 12594:08e4280e5bfd
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Feb 10 03:03:28 2011 +0200
description:
master: Change stderr to /dev/null just before forking.

diffstat:

 src/master/main.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (23 lines):

diff -r 079a81fb5117 -r 08e4280e5bfd src/master/main.c
--- a/src/master/main.c	Thu Feb 10 02:51:22 2011 +0200
+++ b/src/master/main.c	Thu Feb 10 03:03:28 2011 +0200
@@ -771,14 +771,17 @@
 	if (services_listen(services) <= 0)
 		i_fatal("Failed to start listeners");
 
-	if (!foreground)
-		daemonize();
 	if (chdir(set->base_dir) < 0)
 		i_fatal("chdir(%s) failed: %m", set->base_dir);
 
+	if (dup2(null_fd, STDERR_FILENO) < 0)
+		i_fatal("dup2(null_fd) failed: %m");
 	i_set_fatal_handler(master_fatal_callback);
 	i_set_error_handler(orig_error_callback);
 
+	if (!foreground)
+		daemonize();
+
 	main_init(set);
 	master_service_run(master_service, NULL);
 	main_deinit();


More information about the dovecot-cvs mailing list