From: Timo Sirainen Date: Mon, 2 Jun 2008 17:18:11 +0000 (+0300) Subject: dbox sync rebuilding: Don't leave all maildir file fds open until the end of X-Git-Tag: 1.1.rc8~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cccefc3bf5d48081f8f5b5d32e0eed507da3f991;p=thirdparty%2Fdovecot%2Fcore.git dbox sync rebuilding: Don't leave all maildir file fds open until the end of sync. It can cause too many open files. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/dbox/dbox-sync-rebuild.c b/src/lib-storage/index/dbox/dbox-sync-rebuild.c index ef80590242..f39c400c3f 100644 --- a/src/lib-storage/index/dbox/dbox-sync-rebuild.c +++ b/src/lib-storage/index/dbox/dbox-sync-rebuild.c @@ -254,8 +254,12 @@ dbox_sync_index_maildir_file(struct dbox_sync_rebuild_context *ctx, } file = dbox_file_init_new_maildir(ctx->mbox, fname); - if ((ret = dbox_sync_index_file_next(ctx, file, &offset)) > 0) + if ((ret = dbox_sync_index_file_next(ctx, file, &offset)) > 0) { dbox_index_append_file(ctx->append_ctx, file); + /* appending referenced the file, so make sure it gets closed + so we don't have too many open files. */ + dbox_file_close(file); + } dbox_file_unref(&file); return ret < 0 ? -1 : 0; }