[dovecot-cvs] dovecot/src/lib-index mail-transaction-log.c, 1.97, 1.98

cras at dovecot.org cras at dovecot.org
Tue May 10 21:20:50 EEST 2005


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv8512/lib-index

Modified Files:
	mail-transaction-log.c 
Log Message:
Delete transaction log.2 file if we detect it's corrupted.



Index: mail-transaction-log.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-log.c,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -d -r1.97 -r1.98
--- mail-transaction-log.c	29 Apr 2005 10:48:31 -0000	1.97
+++ mail-transaction-log.c	10 May 2005 18:20:47 -0000	1.98
@@ -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);
 



More information about the dovecot-cvs mailing list