dovecot-2.0: sdbox: Avoid using too many fds when copying messages.
dovecot at dovecot.org
dovecot at dovecot.org
Wed May 16 18:57:38 EEST 2012
details: http://hg.dovecot.org/dovecot-2.0/rev/3fff8093ab5b
changeset: 13093:3fff8093ab5b
user: Timo Sirainen <tss at iki.fi>
date: Wed May 16 18:57:05 2012 +0300
description:
sdbox: Avoid using too many fds when copying messages.
This happened at least with quota plugin.
diffstat:
src/lib-storage/index/dbox-single/sdbox-save.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diffs (22 lines):
diff -r 5830e7292909 -r 3fff8093ab5b src/lib-storage/index/dbox-single/sdbox-save.c
--- a/src/lib-storage/index/dbox-single/sdbox-save.c Wed Apr 25 02:50:47 2012 +0300
+++ b/src/lib-storage/index/dbox-single/sdbox-save.c Wed May 16 18:57:05 2012 +0300
@@ -78,9 +78,18 @@
void sdbox_save_add_file(struct mail_save_context *_ctx, struct dbox_file *file)
{
struct sdbox_save_context *ctx = (struct sdbox_save_context *)_ctx;
+ struct dbox_file *const *files;
+ unsigned int count;
if (ctx->first_saved_seq == 0)
ctx->first_saved_seq = ctx->ctx.seq;
+
+ files = array_get(&ctx->files, &count);
+ if (count > 0) {
+ /* a plugin may leave a previously saved file open.
+ we'll close it here to avoid eating too many fds. */
+ dbox_file_close(files[count-1]);
+ }
array_append(&ctx->files, &file, 1);
}
More information about the dovecot-cvs
mailing list