From: Timo Sirainen Date: Thu, 5 Mar 2009 21:37:44 +0000 (-0500) Subject: dbox: Don't close file we appended to if we're still reading from it. X-Git-Tag: 2.0.alpha1~1038^2~68 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fba84c9509c7b02d8c8c85541c5a52fdcab32d1f;p=thirdparty%2Fdovecot%2Fcore.git dbox: Don't close file we appended to if we're still reading from it. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/dbox/dbox-map.c b/src/lib-storage/index/dbox/dbox-map.c index faa80d84ce..d06d846dff 100644 --- a/src/lib-storage/index/dbox/dbox-map.c +++ b/src/lib-storage/index/dbox/dbox-map.c @@ -482,11 +482,13 @@ dbox_map_find_appendable_file(struct dbox_map_append_context *ctx, } /* can't append to this file anymore */ if (files[i-1]->fd != -1) { - /* avoid wasting fds by closing the file */ + /* avoid wasting fds by closing the file, but not if + we're also reading from it. */ if (dbox_file_flush_append(files[i-1]) < 0) return -1; dbox_file_unlock(files[i-1]); - dbox_file_close(files[i-1]); + if (files[i-1]->refcount == 1) + dbox_file_close(files[i-1]); } } ctx->files_nonappendable_count = count;