From 27d6f41d3bdfd9178ad309bd0ece7aaaabbaceb1 Mon Sep 17 00:00:00 2001 From: Dan-Fraser <46791348+Dan-Fraser@users.noreply.github.com> Date: Fri, 22 Feb 2019 10:27:14 -0800 Subject: [PATCH 1/3] Fixed return code of mailimap_logout (#327) The function mailimap_logout() would return MAILIMAP_STREAM_ERROR even after successful logout commands. This patch fixes that by detecting that specific error code in mailimap_logout() and returning the code MAILIMAP_NO_ERROR instead. --- src/low-level/imap/mailimap.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/low-level/imap/mailimap.c b/src/low-level/imap/mailimap.c index 989e20a..0921a7f 100644 --- a/src/low-level/imap/mailimap.c +++ b/src/low-level/imap/mailimap.c @@ -749,7 +749,13 @@ int mailimap_logout(mailimap * session) } r = mailimap_parse_response(session, &response); - if (r != MAILIMAP_NO_ERROR) { + if (r == MAILIMAP_ERROR_STREAM) { + // the response is expected to be MAILIMAP_ERROR_STREAM + // because the server responds with BYE so the stream + // is immediately closed + res = MAILIMAP_NO_ERROR; + goto close; + } else if (r != MAILIMAP_NO_ERROR) { res = r; goto close; } -- 2.21.0