Mercurial > dovecot > core-2.2
changeset 115:91e5141f994c HEAD
fixes for modifylog opening
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 02 Sep 2002 20:56:08 +0300 |
parents | 0c3ffb677ad1 |
children | b1d05f79758f |
files | src/lib-index/mail-modifylog.c |
diffstat | 1 files changed, 13 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-modifylog.c Mon Sep 02 20:51:38 2002 +0300 +++ b/src/lib-index/mail-modifylog.c Mon Sep 02 20:56:08 2002 +0300 @@ -276,6 +276,9 @@ index_set_error(log->index, "IndexID mismatch for modify log " "file %s", path); ret = -1; + + /* we have to rebuild it, make sure it's deleted. */ + (void)unlink(path); } if (ret != -1 && hdr.sync_id == SYNC_ID_FULL) { @@ -296,18 +299,22 @@ static int mail_modifylog_find_or_create(MailModifyLog *log) { const char *path1, *path2; - int i; + int i, ret; for (i = 0; i < 2; i++) { /* first try <index>.log */ path1 = t_strconcat(log->index->filepath, ".log", NULL); - if (mail_modifylog_open_and_verify(log, path1) == 1) + path2 = t_strconcat(log->index->filepath, ".log.2", NULL); + + ret = mail_modifylog_open_and_verify(log, path1); + if (ret == 1) return TRUE; - /* then <index>.log.2 */ - path2 = t_strconcat(log->index->filepath, ".log.2", NULL); - if (mail_modifylog_open_and_verify(log, path2) == 1) - return TRUE; + if (ret == 0) { + /* then <index>.log.2 */ + if (mail_modifylog_open_and_verify(log, path2) == 1) + return TRUE; + } /* try creating/reusing them */ if (mail_modifylog_open_and_init_file(log, path1))