# HG changeset patch # User Timo Sirainen # Date 1175026412 -10800 # Node ID 2704fc574e706772a33fbb26ebb4b8b2a421cac9 # Parent bbb7b3d57593514064af2882c698b1fbbe115c85 /dev/null was opened too late. diff -r bbb7b3d57593 -r 2704fc574e70 src/master/main.c --- a/src/master/main.c Tue Mar 27 22:59:28 2007 +0300 +++ b/src/master/main.c Tue Mar 27 23:13:32 2007 +0300 @@ -537,14 +537,16 @@ return FALSE; } -static void open_fds(void) +static void open_null_fd(void) { - /* initialize fds. */ null_fd = open("/dev/null", O_RDONLY); if (null_fd == -1) i_fatal("Can't open /dev/null: %m"); fd_close_on_exec(null_fd, TRUE); +} +static void open_fds(void) +{ /* make sure all fds between 0..3 are used. */ while (null_fd < 4) { null_fd = dup(null_fd); @@ -833,6 +835,9 @@ } } + /* need to have this open before reading settings */ + open_null_fd(); + if (getenv("DOVECOT_INETD") != NULL) { /* starting through inetd. */ inetd_login_fd = dup(0);