changeset 15208:5ab90cdee9e5

[gaim-migrate @ 17997] If a buddy icon cannot be retrieved from a conversation, or if the buddy icon write to disk fails to complete, unlink the icon file and abort. This silences a warning, and is more correct to boot. committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Thu, 14 Dec 2006 16:18:49 +0000
parents 1df707ddf056
children ae5eb8de9574
files gtk/gtkconv.c
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gtk/gtkconv.c	Thu Dec 14 05:56:50 2006 +0000
+++ b/gtk/gtkconv.c	Thu Dec 14 16:18:49 2006 +0000
@@ -2404,13 +2404,12 @@
 	icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv));
 	data = gaim_buddy_icon_get_data(icon, &len);
 
-	if ((len <= 0) || (data == NULL)) {
+	if ((len <= 0) || (data == NULL) || (fwrite(data, 1, len, fp) != 1)) {
 		gaim_notify_error(gtkconv, NULL, _("Unable to save icon file to disk."), NULL);
 		fclose(fp);
+		g_unlink(filename);
 		return;
 	}
-
-	fwrite(data, 1, len, fp);
 	fclose(fp);
 }