]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dbox sync rebuilding: Don't leave all maildir file fds open until the end of
authorTimo Sirainen <tss@iki.fi>
Mon, 2 Jun 2008 17:18:11 +0000 (20:18 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 2 Jun 2008 17:18:11 +0000 (20:18 +0300)
sync. It can cause too many open files.

--HG--
branch : HEAD

src/lib-storage/index/dbox/dbox-sync-rebuild.c

index ef80590242d6e288c350b70161792f16d706980c..f39c400c3fccfbfa2d719339a2ae32ddec307ad5 100644 (file)
@@ -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;
 }