changeset 17574:9c6643daae98

fts: If we detect corrupted fts expunge log, unlink it. This avoids the same error repeating forever.
author Timo Sirainen <tss@iki.fi>
date Thu, 03 Jul 2014 14:37:08 +0300
parents 140619879047
children abf049058125
files src/plugins/fts/fts-expunge-log.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/fts/fts-expunge-log.c	Thu Jul 03 12:44:50 2014 +0300
+++ b/src/plugins/fts/fts-expunge-log.c	Thu Jul 03 14:37:08 2014 +0300
@@ -459,6 +459,11 @@
 
 	*_ctx = NULL;
 
+	if (ctx->corrupted) {
+		if (unlink(ctx->log->path) < 0 && errno != ENOENT)
+			i_error("unlink(%s) failed: %m", ctx->log->path);
+	}
+
 	if (ctx->input != NULL)
 		i_stream_unref(&ctx->input);
 	i_free(ctx);