[dovecot-cvs] dovecot/src/master main.c,1.80.2.7,1.80.2.8
cras at dovecot.org
cras at dovecot.org
Sun Jul 2 16:55:32 EEST 2006
Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv5883
Modified Files:
Tag: branch_1_0
main.c
Log Message:
If something in io_loop_create() failed, we logged the error to /dev/null.
Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/main.c,v
retrieving revision 1.80.2.7
retrieving revision 1.80.2.8
diff -u -d -r1.80.2.7 -r1.80.2.8
--- main.c 2 Jul 2006 11:03:56 -0000 1.80.2.7
+++ main.c 2 Jul 2006 13:55:30 -0000 1.80.2.8
@@ -509,17 +509,11 @@
if (!IS_INETD())
listen_fds_open(FALSE);
- /* close stdin and stdout. close stderr unless we're logging
- into /dev/stderr. */
+ /* close stdin and stdout. */
if (dup2(null_fd, 0) < 0)
i_fatal("dup2(0) failed: %m");
if (dup2(null_fd, 1) < 0)
i_fatal("dup2(1) failed: %m");
-
- if (!have_stderr(settings_root)) {
- if (dup2(null_fd, 2) < 0)
- i_fatal("dup2(2) failed: %m");
- }
}
static void create_pid_file(const char *path)
@@ -542,6 +536,14 @@
/* deny file access from everyone else except owner */
(void)umask(0077);
+ /* close stderr unless we're logging into /dev/stderr. keep as little
+ distance between closing it and opening the actual log file so that
+ we don't lose anything. */
+ if (!have_stderr(settings_root)) {
+ if (dup2(null_fd, 2) < 0)
+ i_fatal("dup2(2) failed: %m");
+ }
+
set_logfile(settings_root->defaults);
i_info("Dovecot v"VERSION" starting up");
More information about the dovecot-cvs
mailing list