Mercurial > dovecot > core-2.2
changeset 12238:2b8b2875af26
lib-index: Fixed leaking fds when writing to dovecot.mailbox.log
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 04 Oct 2010 15:55:34 +0100 |
parents | 1df6a392a613 |
children | 45812039b7ce |
files | src/lib-index/mailbox-log.c |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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