[dovecot-cvs] dovecot/src/master main.c,1.80.2.19,1.80.2.20

tss at dovecot.org tss at dovecot.org
Tue Mar 27 23:13:32 EEST 2007


Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv30206

Modified Files:
      Tag: branch_1_0
	main.c 
Log Message:
/dev/null was opened too late.



Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/main.c,v
retrieving revision 1.80.2.19
retrieving revision 1.80.2.20
diff -u -d -r1.80.2.19 -r1.80.2.20
--- main.c	26 Mar 2007 19:23:41 -0000	1.80.2.19
+++ main.c	27 Mar 2007 20:13:30 -0000	1.80.2.20
@@ -521,14 +521,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);
@@ -805,6 +807,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);



More information about the dovecot-cvs mailing list