[dovecot-cvs] dovecot/src/lib-storage/index index-status.c,1.21,1.22
cras at procontrol.fi
cras at procontrol.fi
Sat Dec 21 12:59:25 EET 2002
Update of /home/cvs/dovecot/src/lib-storage/index
In directory danu:/tmp/cvs-serv6191/lib-storage/index
Modified Files:
index-status.c
Log Message:
Better checking for corrupted first_unseen_uid_lowwater.
Index: index-status.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-status.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- index-status.c 18 Dec 2002 01:23:20 -0000 1.21
+++ index-status.c 21 Dec 2002 10:59:23 -0000 1.22
@@ -2,6 +2,7 @@
#include "lib.h"
#include "mail-custom-flags.h"
+#include "mail-index-util.h"
#include "index-storage.h"
static unsigned int get_first_unseen_seq(MailIndex *index)
@@ -24,13 +25,6 @@
/* begin scanning from the low water mark */
rec = index->lookup_uid_range(index, lowwater_uid,
hdr->next_uid - 1, &seq);
- if (rec == NULL) {
- i_error("index header's seen_messages_count (%u) or "
- "first_unseen_uid_lowwater (%u) is invalid.",
- hdr->seen_messages_count, lowwater_uid);
- INDEX_MARK_CORRUPTED(index);
- return 0;
- }
} else {
/* begin scanning from the beginning */
rec = index->lookup(index, 1);
@@ -42,14 +36,23 @@
seq++;
}
- if (rec != NULL && rec->uid != lowwater_uid) {
+ if (rec == NULL) {
+ index_set_corrupted(index, "No unseen messages found with "
+ "first_unseen_uid_lowwater %u, "
+ "seen_messages_count %u, messages_count %u",
+ lowwater_uid, hdr->seen_messages_count,
+ hdr->messages_count);
+ return 0;
+ }
+
+ if (rec->uid != lowwater_uid) {
/* update the low water mark if we can get exclusive
lock immediately. */
if (index->try_lock(index, MAIL_LOCK_EXCLUSIVE))
hdr->first_unseen_uid_lowwater = rec->uid;
}
- return rec == NULL ? 0 : seq;
+ return seq;
}
static void
More information about the dovecot-cvs
mailing list