[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-save.c,1.23,1.24
cras at procontrol.fi
cras at procontrol.fi
Wed Nov 20 20:31:17 EET 2002
Update of /home/cvs/dovecot/src/lib-storage/index/mbox
In directory danu:/tmp/cvs-serv21212/mbox
Modified Files:
mbox-save.c
Log Message:
COPYing inside same mailbox works now with mbox. Also fixed SAVE leaving
From-line written to mbox file if it was aborted.
Index: mbox-save.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-save.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- mbox-save.c 13 Nov 2002 01:36:16 -0000 1.23
+++ mbox-save.c 20 Nov 2002 18:31:15 -0000 1.24
@@ -176,7 +176,7 @@
return FALSE;
}
- /* we don't need the real flags, easier to keep using our own.
+ /* we don't need the real flag positions, easier to keep using our own.
they need to be checked/added though. */
real_flags = flags;
if (!index_mailbox_fix_custom_flags(ibox, &real_flags, custom_flags))
@@ -205,7 +205,10 @@
!index_storage_save(box->storage, mbox_path,
data, outbuf, data_size) ||
!mbox_append_lf(box->storage, outbuf, mbox_path)) {
- /* failed, truncate file back to original size */
+ /* failed, truncate file back to original size.
+ output buffer needs to be flushed before truncating
+ so unref() won't write anything. */
+ o_buffer_flush(outbuf);
(void)ftruncate(index->mbox_fd, pos);
failed = TRUE;
}
@@ -213,8 +216,11 @@
t_pop();
}
- if (!ibox->index->set_lock(ibox->index, MAIL_LOCK_UNLOCK))
- return mail_storage_set_index_error(ibox);
+ /* kludgy.. for copying inside same mailbox. */
+ if (!ibox->delay_save_unlocking) {
+ if (!ibox->index->set_lock(ibox->index, MAIL_LOCK_UNLOCK))
+ return mail_storage_set_index_error(ibox);
+ }
return !failed;
}
More information about the dovecot-cvs
mailing list