[dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-uidlist.c, 1.20, 1.21

cras at dovecot.org cras at dovecot.org
Sun Apr 9 18:50:29 EEST 2006


Update of /var/lib/cvs/dovecot/src/lib-storage/index/dbox
In directory talvi:/tmp/cvs-serv6879/lib-storage/index/dbox

Modified Files:
	dbox-uidlist.c 
Log Message:
Added MAILBOX_OPEN_KEEP_LOCKED flag to mailbox opening and implemented it
for mbox and maildir. It keeps the mailbox locked the whole time until
mailbox_close() is called.



Index: dbox-uidlist.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-uidlist.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- dbox-uidlist.c	31 Mar 2006 21:21:20 -0000	1.20
+++ dbox-uidlist.c	9 Apr 2006 15:50:26 -0000	1.21
@@ -860,11 +860,10 @@
 static int
 dbox_file_append(struct dbox_uidlist_append_ctx *ctx,
 		 const char *path, struct dbox_uidlist_entry *entry,
-		 struct dbox_file **file_r)
+		 struct stat *st, struct dbox_file **file_r)
 {
 	struct dbox_mailbox *mbox = ctx->uidlist->mbox;
 	struct dbox_file *file;
-	struct stat st;
 	int fd;
 
 	*file_r = NULL;
@@ -876,7 +875,7 @@
 		return -1;
 	}
 
-	if (fstat(fd, &st) < 0) {
+	if (fstat(fd, st) < 0) {
 		mail_storage_set_critical(STORAGE(mbox->storage),
 					  "fstat(%s) failed: %m", path);
 		(void)close(fd);
@@ -890,7 +889,7 @@
 	file->input = i_stream_create_file(file->fd, default_pool,
 					   65536, FALSE);
 	file->output = o_stream_create_file(file->fd, default_pool, 0, FALSE);
-	if ((uoff_t)st.st_size < sizeof(struct dbox_file_header)) {
+	if ((uoff_t)st->st_size < sizeof(struct dbox_file_header)) {
 		if (dbox_file_write_header(mbox, file) < 0) {
 			dbox_file_close(file);
 			return -1;
@@ -1009,7 +1008,8 @@
 		if (dbox_file_append_lock(ctx, path, &file_seq,
 					  &entry, &dotlock) < 0)
 			return -1;
-	} while ((ret = dbox_file_append(ctx, str_c(path), entry, &file)) == 0);
+	} while ((ret = dbox_file_append(ctx, str_c(path), entry,
+					 &st, &file)) == 0);
 
 	if (ret < 0) {
 		file_dotlock_delete(&dotlock);



More information about the dovecot-cvs mailing list