changeset 12417:967de059f94d

dbox: dbox file could have been closed too early in some situations, causing EBADF errors.
author Timo Sirainen <tss@iki.fi>
date Mon, 15 Nov 2010 15:42:21 +0000
parents eb08ed7c6a7b
children 3f19e7e43506
files src/lib-storage/index/dbox-common/dbox-mail.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/dbox-common/dbox-mail.c	Mon Nov 15 15:31:26 2010 +0000
+++ b/src/lib-storage/index/dbox-common/dbox-mail.c	Mon Nov 15 15:42:21 2010 +0000
@@ -32,9 +32,11 @@
 {
 	struct dbox_mail *mail = (struct dbox_mail *)_mail;
 
+	index_mail_close(_mail);
+	/* close the dbox file only after index is closed, since it may still
+	   try to read from it. */
 	if (mail->open_file != NULL)
 		dbox_file_unref(&mail->open_file);
-	index_mail_close(_mail);
 }
 
 int dbox_mail_metadata_read(struct dbox_mail *mail, struct dbox_file **file_r)