evolution r37245 - branches/gnome-2-24/mail



Author: mcrha
Date: Wed Feb 11 09:54:13 2009
New Revision: 37245
URL: http://svn.gnome.org/viewvc/evolution?rev=37245&view=rev

Log:
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.



Modified:
   branches/gnome-2-24/mail/ChangeLog
   branches/gnome-2-24/mail/em-format-html.c

Modified: branches/gnome-2-24/mail/em-format-html.c
==============================================================================
--- branches/gnome-2-24/mail/em-format-html.c	(original)
+++ branches/gnome-2-24/mail/em-format-html.c	Wed Feb 11 09:54:13 2009
@@ -531,17 +531,12 @@
 				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);
 
@@ -549,8 +544,12 @@
 	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:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]