dovecot-2.1: sdbox: Avoid using too many fds when copying messages.
dovecot at dovecot.org
dovecot at dovecot.org
Wed May 16 18:57:28 EEST 2012
details: http://hg.dovecot.org/dovecot-2.1/rev/6d11513cdd0d
changeset: 14531:6d11513cdd0d
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 ca0fef559d43 -r 6d11513cdd0d src/lib-storage/index/dbox-single/sdbox-save.c
--- a/src/lib-storage/index/dbox-single/sdbox-save.c Wed May 16 16:14:31 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