From: Wilfried Goesgens Date: Tue, 7 Dec 2010 22:30:12 +0000 (+0100) Subject: Correctly evaluate whether we have a decoded mime part, or if we need to output the... X-Git-Tag: v8.01~530^2 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=2e3db2c14ee40f87441aade40696e84af384e429;p=citadel.git Correctly evaluate whether we have a decoded mime part, or if we need to output the raw content. --- diff --git a/libcitadel/tests/mimeparser_test.c b/libcitadel/tests/mimeparser_test.c index 57decd887..acb1a0087 100644 --- a/libcitadel/tests/mimeparser_test.c +++ b/libcitadel/tests/mimeparser_test.c @@ -145,12 +145,17 @@ static void mime_download(char *name, encoding, &decoded, &bytes_decoded); - if ((rc < 0) || (decoded == NULL)) { + if (rc < 0) { printf("failed to decode content\n"); return; } - rc = write(STDOUT_FILENO, content, length); - free(decoded); + if (rc == 0){ + rc = write(STDOUT_FILENO, content, length); + } + else { + rc = write(STDOUT_FILENO, decoded, bytes_decoded); + free(decoded); + } } }