Fix bug in IMAP debug output
authorHugo Villeneuve <hugo@hugovil.com>
Sat, 14 Jan 2017 16:01:58 +0000 (11:01 -0500)
committerHugo Villeneuve <hugo@hugovil.com>
Sat, 14 Jan 2017 16:02:00 +0000 (11:02 -0500)
Garbage from previous response was sometimes displayed in debug output.

src/imap.c

index eae62ce..13a3b0b 100644 (file)
@@ -117,10 +117,6 @@ get_packet:
                goto error;
        }
 
-       if (wmnotify_infos.debug) {
-               printf("%s", rx_buffer);
-       }
-
        /*
         * Converting the last CRLF into a LF followed by a NULL termination
         * character.
@@ -128,6 +124,10 @@ get_packet:
        rx_buffer[len - 2] = '\n';
        rx_buffer[len - 1] = '\0';
 
+       if (wmnotify_infos.debug) {
+               printf("%s", rx_buffer);
+       }
+
        /*
         * Check the Server Completion Response returned by the IMAP4 server.
         * There are currently three Server Completion Responses codes: