changeset 6981:66b439e24c47 HEAD

If we're rotating log file while we're locked, lock the newly created file so the lock is preserved.
author Timo Sirainen <tss@iki.fi>
date Sun, 09 Dec 2007 16:20:35 +0200
parents d373913cd763
children c8df2492959e
files src/lib-index/mail-transaction-log-file.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
 	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)