aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-format-html.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-02-11 17:54:05 +0800
committerMilan Crha <mcrha@src.gnome.org>2009-02-11 17:54:05 +0800
commitec49abcb7ce88f0549fa54a66d4523e5a355b942 (patch)
tree39d0832d20dbc515ada540e467f12a35aec49d3a /mail/em-format-html.c
parentaf9c978259a22fae6c21eaf3d886b04cf4a96e60 (diff)
downloadgsoc2013-evolution-ec49abcb7ce88f0549fa54a66d4523e5a355b942.tar
gsoc2013-evolution-ec49abcb7ce88f0549fa54a66d4523e5a355b942.tar.gz
gsoc2013-evolution-ec49abcb7ce88f0549fa54a66d4523e5a355b942.tar.bz2
gsoc2013-evolution-ec49abcb7ce88f0549fa54a66d4523e5a355b942.tar.lz
gsoc2013-evolution-ec49abcb7ce88f0549fa54a66d4523e5a355b942.tar.xz
gsoc2013-evolution-ec49abcb7ce88f0549fa54a66d4523e5a355b942.tar.zst
gsoc2013-evolution-ec49abcb7ce88f0549fa54a66d4523e5a355b942.zip
** Fix for bug #333716
2009-02-11 Milan Crha <mcrha@redhat.com> ** Fix for bug #333716 * em-format-html.c: (emfh_gethttp): Do not store incomplete or broken files in a cache. svn path=/trunk/; revision=37244
Diffstat (limited to 'mail/em-format-html.c')
-rw-r--r--mail/em-format-html.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index f813ef01fb..21cbcf0e92 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -533,17 +533,12 @@ static void emfh_gethttp(struct _EMFormatHTMLJob *job, int cancelled)
camel_operation_progress(NULL, pc_complete);
}
d(printf(" read %d bytes\n", n));
- if (costream && camel_stream_write(costream, buffer, n) == -1) {
- camel_data_cache_remove(emfh_http_cache, EMFH_HTTP_CACHE_PATH, job->u.uri, NULL);
- camel_object_unref(costream);
- costream = NULL;
+ if (costream && camel_stream_write (costream, buffer, n) == -1) {
+ n = -1;
+ break;
}
camel_stream_write(job->stream, buffer, n);
- } else if (n < 0 && costream) {
- camel_data_cache_remove(emfh_http_cache, EMFH_HTTP_CACHE_PATH, job->u.uri, NULL);
- camel_object_unref(costream);
- costream = NULL;
}
} while (n>0);
@@ -551,8 +546,12 @@ static void emfh_gethttp(struct _EMFormatHTMLJob *job, int cancelled)
if (n == 0)
camel_stream_close(job->stream);
- if (costream)
+ if (costream) {
+ /* do not store broken files in a cache */
+ if (n != 0)
+ camel_data_cache_remove(emfh_http_cache, EMFH_HTTP_CACHE_PATH, job->u.uri, NULL);
camel_object_unref(costream);
+ }
camel_object_unref(instream);
done: