[dovecot-cvs] dovecot/src/lib-index mail-index.c, 1.115, 1.116 mail-index.h, 1.101, 1.102

cras at procontrol.fi cras at procontrol.fi
Sat May 1 19:42:12 EEST 2004


Update of /home/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv20454/lib-index

Modified Files:
	mail-index.c mail-index.h 
Log Message:
cleanup



Index: mail-index.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -d -r1.115 -r1.116
--- mail-index.c	1 May 2004 16:22:54 -0000	1.115
+++ mail-index.c	1 May 2004 16:42:10 -0000	1.116
@@ -655,32 +655,30 @@
 	index->indexid = 0;
 }
 
-int mail_index_mark_corrupted(struct mail_index *index)
+void mail_index_mark_corrupted(struct mail_index *index)
 {
 	struct mail_index_header hdr;
 
+	mail_index_set_inconsistent(index);
+
 	if (index->readonly)
-		return 0;
+		return;
 
 	/* make sure we can write the header */
 	if (!MAIL_INDEX_MAP_IS_IN_MEMORY(index->map)) {
 		if (mprotect(index->map->mmap_base, sizeof(hdr),
 			     PROT_READ | PROT_WRITE) < 0) {
 			mail_index_set_syscall_error(index, "mprotect()");
-			return -1;
+			return;
 		}
 	}
 
 	hdr = *index->hdr;
 	hdr.flags |= MAIL_INDEX_HDR_FLAG_CORRUPTED;
-	if (mail_index_write_header(index, &hdr) < 0)
-		return -1;
-
-	if (fsync(index->fd) < 0)
-		return mail_index_set_syscall_error(index, "fsync()");
-
-	mail_index_set_inconsistent(index);
-	return 0;
+	if (mail_index_write_header(index, &hdr) == 0) {
+		if (fsync(index->fd) < 0)
+			mail_index_set_syscall_error(index, "fsync()");
+	}
 }
 
 int mail_index_set_syscall_error(struct mail_index *index,

Index: mail-index.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.h,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -d -r1.101 -r1.102
--- mail-index.h	1 May 2004 16:30:58 -0000	1.101
+++ mail-index.h	1 May 2004 16:42:10 -0000	1.102
@@ -213,7 +213,7 @@
 int mail_index_sync_end(struct mail_index_sync_ctx *ctx);
 
 /* Mark index file corrupted. Invalidates all views. */
-int mail_index_mark_corrupted(struct mail_index *index);
+void mail_index_mark_corrupted(struct mail_index *index);
 /* Check and fix any found problems. If index is broken beyond repair, calls
    mail_index_reset() and returns 0. Otherwise returns -1 if there was some
    I/O error or 1 if everything went ok. */



More information about the dovecot-cvs mailing list