Mercurial > pidgin
diff libpurple/buddyicon.c @ 21847:378eb1893499
merge of '7a1ce8ae9c2809b39d1f436d94070523f18993fb'
and '94d88332e1e7b8227ef79d0d74873475069c85f4'
author | Will Thompson <will.thompson@collabora.co.uk> |
---|---|
date | Mon, 17 Dec 2007 12:10:55 +0000 |
parents | a3bc0682e98d |
children | f314129eaaf5 |
line wrap: on
line diff
--- a/libpurple/buddyicon.c Mon Dec 17 12:09:59 2007 +0000 +++ b/libpurple/buddyicon.c Mon Dec 17 12:10:55 2007 +0000 @@ -98,8 +98,7 @@ { const char *dirname; char *path; - FILE *file = NULL; - + g_return_if_fail(img != NULL); if (!purple_buddy_icons_is_caching()) @@ -120,24 +119,12 @@ } } - if ((file = g_fopen(path, "wb")) != NULL) - { - if (!fwrite(purple_imgstore_get_data(img), purple_imgstore_get_size(img), 1, file)) - { - purple_debug_error("buddyicon", "Error writing %s: %s\n", - path, g_strerror(errno)); - } - else - purple_debug_info("buddyicon", "Wrote cache file: %s\n", path); - - fclose(file); - } - else - { + if (!g_file_test(path, G_FILE_TEST_EXISTS)) { + purple_util_write_data_to_file_absolute(path, purple_imgstore_get_data(img), + purple_imgstore_get_size(img)); + } else { purple_debug_error("buddyicon", "Unable to create file %s: %s\n", path, g_strerror(errno)); - g_free(path); - return; } g_free(path); }