dovecot-2.0: lib-index: Fixed leaking fds when writing to doveco...

dovecot at dovecot.org dovecot at dovecot.org
Mon Oct 4 17:55:40 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/2b8b2875af26
changeset: 12238:2b8b2875af26
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 04 15:55:34 2010 +0100
description:
lib-index: Fixed leaking fds when writing to dovecot.mailbox.log

diffstat:

 src/lib-index/mailbox-log.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (25 lines):

diff -r 1df6a392a613 -r 2b8b2875af26 src/lib-index/mailbox-log.c
--- a/src/lib-index/mailbox-log.c	Mon Oct 04 15:13:20 2010 +0100
+++ b/src/lib-index/mailbox-log.c	Mon Oct 04 15:55:34 2010 +0100
@@ -83,6 +83,8 @@
 {
 	mode_t old_mode;
 
+	i_assert(log->fd == -1);
+
 	log->open_timestamp = ioloop_time;
 	log->fd = open(log->filepath, O_RDWR | O_APPEND);
 	if (log->fd != -1)
@@ -161,8 +163,10 @@
 	   it shouldn't keep writing to a rotated log forever. */
 	if (log->open_timestamp != ioloop_time)
 		mailbox_log_close(log);
-	if (mailbox_log_open(log) < 0)
-		return -1;
+	if (log->fd == -1) {
+		if (mailbox_log_open(log) < 0)
+			return -1;
+	}
 
 	/* We don't bother with locking, atomic appends will protect us.
 	   If they don't (NFS), the worst that can happen is that a few


More information about the dovecot-cvs mailing list