struct maildir_save_context *ctx = (struct maildir_save_context *)_ctx;
struct mail_storage *storage = &ctx->mbox->storage->storage;
const char *path;
+ off_t real_size;
int output_errno;
ctx->last_save_finished = TRUE;
ctx->failed = TRUE;
}
}
+ real_size = lseek(ctx->fd, 0, SEEK_END);
+ if (real_size == (off_t)-1) {
+ mail_storage_set_critical(storage,
+ "lseek(%s) failed: %m", path);
+ } else if (real_size != (off_t)ctx->file_last->size) {
+ /* e.g. zlib plugin was used. the "physical size" must be in
+ the maildir filename, since stat() will return wrong size */
+ ctx->file_last->preserve_filename = FALSE;
+ }
if (close(ctx->fd) < 0) {
if (!mail_storage_set_error_from_errno(storage)) {
mail_storage_set_critical(storage,