dovecot: If we're rotating log file while we're locked, lock the...

dovecot at dovecot.org dovecot at dovecot.org
Sun Dec 9 16:20:42 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/66b439e24c47
changeset: 6981:66b439e24c47
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Dec 09 16:20:35 2007 +0200
description:
If we're rotating log file while we're locked, lock the newly created file
so the lock is preserved.

diffstat:

1 file changed, 6 insertions(+)
src/lib-index/mail-transaction-log-file.c |    6 ++++++

diffs (16 lines):

diff -r d373913cd763 -r 66b439e24c47 src/lib-index/mail-transaction-log-file.c
--- a/src/lib-index/mail-transaction-log-file.c	Sun Dec 09 16:08:25 2007 +0200
+++ b/src/lib-index/mail-transaction-log-file.c	Sun Dec 09 16:20:35 2007 +0200
@@ -519,6 +519,12 @@ mail_transaction_log_file_create2(struct
 	file->fd = new_fd;
 	ret = mail_transaction_log_file_stat(file, FALSE);
 
+	if (file->log->head != NULL && file->log->head->locked) {
+		/* we'll need to preserve the lock */
+		if (mail_transaction_log_file_lock(file) < 0)
+			ret = -1;
+	}
+
 	/* if we return -1 the dotlock deletion code closes the fd */
 	file->fd = -1;
 	if (ret < 0)


More information about the dovecot-cvs mailing list