From 69cce44424b55a465ee0bb8be46b8d6a779c4880 Mon Sep 17 00:00:00 2001 From: Timo Sirainen <timo.sirainen@dovecot.fi> Date: Mon, 16 May 2016 16:08:41 +0300 Subject: [PATCH] managesieve: Adjust to new o_stream_send_istream() API --- src/managesieve/cmd-getscript.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/managesieve/cmd-getscript.c b/src/managesieve/cmd-getscript.c index e1c9793d6..070999884 100644 --- a/src/managesieve/cmd-getscript.c +++ b/src/managesieve/cmd-getscript.c @@ -16,7 +16,7 @@ struct cmd_getscript_context { struct client *client; struct client_command_context *cmd; struct sieve_storage *storage; - uoff_t script_size, script_offset; + uoff_t script_size; struct sieve_script *script; struct istream *script_stream; @@ -73,16 +73,14 @@ static bool cmd_getscript_continue(struct client_command_context *cmd) return cmd_getscript_finish(ctx); } - ctx->script_offset += ret; - - if ( ctx->script_offset != ctx->script_size && !ctx->failed ) { + if ( ctx->script_stream->v_offset != ctx->script_size && !ctx->failed ) { /* unfinished */ if ( !i_stream_have_bytes_left(ctx->script_stream) ) { /* Input stream gave less data than expected */ sieve_storage_set_critical(ctx->storage, "GETSCRIPT for script `%s' from %s got too little data: " "%"PRIuUOFF_T" vs %"PRIuUOFF_T, sieve_script_name(ctx->script), - sieve_script_location(ctx->script), ctx->script_offset, ctx->script_size); + sieve_script_location(ctx->script), ctx->script_stream->v_offset, ctx->script_size); client_disconnect(ctx->client, "GETSCRIPT failed"); ctx->failed = TRUE; @@ -135,7 +133,7 @@ bool cmd_getscript(struct client_command_context *cmd) return cmd_getscript_finish(ctx); } - ctx->script_offset = 0; + i_assert(ctx->script_stream->v_offset == 0); client_send_line (client, t_strdup_printf("{%"PRIuUOFF_T"}", ctx->script_size)); -- GitLab