[dovecot-cvs] dovecot/src/master main.c,1.103,1.104

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


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

Modified Files:
	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.103
retrieving revision 1.104
diff -u -d -r1.103 -r1.104
--- main.c	26 Mar 2007 19:23:45 -0000	1.103
+++ main.c	27 Mar 2007 20:13:32 -0000	1.104
@@ -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);



More information about the dovecot-cvs mailing list