always use return value from get_cmd_result()

once we have callback-based error reporting, this will ensure that we
don't operate on invalidated data structures.
This commit is contained in:
Oswald Buddenhagen 2011-03-20 13:45:42 +01:00
parent 121ce76e46
commit 06ccac1fdd

View File

@ -503,7 +503,8 @@ v_submit_imap_cmd( imap_store_t *ctx, struct imap_cmd *cmd,
char buf[1024];
while (ctx->literal_pending)
get_cmd_result( ctx, 0 );
if (get_cmd_result( ctx, 0 ) == RESP_BAD)
goto bail;
if (!cmd)
cmd = new_imap_cmd();
@ -625,12 +626,14 @@ drain_imap_replies( imap_store_t *ctx )
}
*/
static void
static int
process_imap_replies( imap_store_t *ctx )
{
while (ctx->num_in_progress > max_in_progress ||
socket_pending( &ctx->buf.sock ))
get_cmd_result( ctx, 0 );
if (get_cmd_result( ctx, 0 ) == RESP_BAD)
return RESP_BAD;
return RESP_OK;
}
static int
@ -1616,8 +1619,7 @@ imap_flags_helper( imap_store_t *ctx, int uid, char what, int flags)
buf[imap_make_flags( flags, buf )] = 0;
if (!submit_imap_cmd( ctx, 0, "UID STORE %d %cFLAGS.SILENT %s", uid, what, buf ))
return DRV_STORE_BAD;
process_imap_replies( ctx );
return DRV_OK;
return process_imap_replies( ctx ) == RESP_BAD ? DRV_STORE_BAD : DRV_OK;
}
static int