diff pidgin/gtkconv.c @ 25344:aa1fe87558d8

propagate from branch 'im.pidgin.pidgin' (head c3f6487e649e7fe5c5f960b9c86a256e09b3976e) to branch 'im.pidgin.pidgin.next.minor' (head 4a65748e82aa462266320a3bbb78e0170a25ff4b)
author Richard Laager <rlaager@wiktel.com>
date Sun, 30 Nov 2008 06:25:26 +0000
parents 94fa7211eb98 cff5d920b87f
children 65cfc59858cf
line wrap: on
line diff
--- a/pidgin/gtkconv.c	Fri Nov 28 06:06:35 2008 +0000
+++ b/pidgin/gtkconv.c	Sun Nov 30 06:25:26 2008 +0000
@@ -2759,26 +2759,16 @@
 {
 	PidginConversation *gtkconv = (PidginConversation *)user_data;
 	PurpleConversation *conv = gtkconv->active_conv;
-	FILE *fp;
 	PurpleBuddyIcon *icon;
 	const void *data;
 	size_t len;
 
-	if ((fp = g_fopen(filename, "wb")) == NULL) {
-		purple_notify_error(gtkconv, NULL, _("Unable to open file."), NULL);
-		return;
-	}
-
 	icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv));
 	data = purple_buddy_icon_get_data(icon, &len);
 
-	if ((len <= 0) || (data == NULL) || (fwrite(data, 1, len, fp) != len)) {
+	if ((len <= 0) || (data == NULL) || !purple_util_write_data_to_file_absolute(filename, data, len)) {
 		purple_notify_error(gtkconv, NULL, _("Unable to save icon file to disk."), NULL);
-		fclose(fp);
-		g_unlink(filename);
-		return;
-	}
-	fclose(fp);
+	}
 }
 
 static void