# HG changeset patch # User John Bailey # Date 1228001712 0 # Node ID cff5d920b87f9cb37a26caf1843aad795495b428 # Parent e1c38e93d5c35aeb39616bceaebfbbddc3bff19e Replace some old code using fwrite() with a call to purple_util_write_data_to_file_absolute(), simplifying some code and improving readability. Fixes #3525. diff -r e1c38e93d5c3 -r cff5d920b87f COPYRIGHT --- a/COPYRIGHT Sat Nov 29 19:53:05 2008 +0000 +++ b/COPYRIGHT Sat Nov 29 23:35:12 2008 +0000 @@ -436,6 +436,7 @@ Brad Turcotte Kyle Turman Junichi Uekawa +Eduardo Pérez Ureta Igor Vlasenko István Váradi Martijn van Beers diff -r e1c38e93d5c3 -r cff5d920b87f pidgin/gtkconv.c --- a/pidgin/gtkconv.c Sat Nov 29 19:53:05 2008 +0000 +++ b/pidgin/gtkconv.c Sat Nov 29 23:35:12 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