From 2e3db2c14ee40f87441aade40696e84af384e429 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Tue, 7 Dec 2010 23:30:12 +0100 Subject: [PATCH] Correctly evaluate whether we have a decoded mime part, or if we need to output the raw content. --- libcitadel/tests/mimeparser_test.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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); + } } } -- 2.39.2