changeset 3368:1069b25164d1 HEAD

Delete transaction log.2 file if we detect it's corrupted.
author Timo Sirainen <tss@iki.fi>
date Tue, 10 May 2005 21:20:47 +0300
parents 06fc33bcfa28
children b4a462cc8737
files src/lib-index/mail-transaction-log.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-transaction-log.c	Tue May 10 20:05:32 2005 +0300
+++ b/src/lib-index/mail-transaction-log.c	Tue May 10 21:20:47 2005 +0300
@@ -869,6 +869,11 @@
 	ret = mail_transaction_log_file_fd_open(log, &file, path, fd, FALSE);
 	if (ret <= 0) {
 		if (ret == 0) {
+			/* corrupted, delete it */
+			if (unlink(file->filepath) < 0 && errno != ENOENT) {
+				i_error("unlink(%s) failed: %m",
+					file->filepath);
+			}
 			mail_transaction_log_file_close(file);
 			return 0;
 		}
@@ -892,7 +897,7 @@
         const struct mail_transaction_header *hdr;
 	const void *data;
 	size_t size;
-	uint32_t hdr_size;
+	uint32_t hdr_size = 0;
 
 	data = buffer_get_data(file->buffer, &size);