# HG changeset patch # User Sean Egan # Date 1177645310 0 # Node ID 63f70c76f8c57b1ab0892145cdc65084e3d93c98 # Parent ccec9581f071a7ff31b151b192fc6db56667d990 Proper error checking on fwrite() call diff -r ccec9581f071 -r 63f70c76f8c5 libpurple/core.c --- a/libpurple/core.c Fri Apr 27 03:27:29 2007 +0000 +++ b/libpurple/core.c Fri Apr 27 03:41:50 2007 +0000 @@ -310,7 +310,7 @@ gboolean purple_core_migrate(void) { -#error This code wants to migrate your .gaim directory to .purple. It is strongly suggested that you back .gaim up before proceeding. +#error You probably want to back up your .gaim directory right now. This revision is going to destroy it, potentially not in the way we've intended const char *user_dir = purple_user_dir(); char *old_user_dir = g_strconcat(purple_home_dir(), G_DIR_SEPARATOR_S ".gaim", NULL); @@ -597,7 +597,7 @@ return FALSE; } - if (!fwrite(buf, size, 1, new_file)) + if (!fwrite(buf, size, 1, new_file) && ferror(new_file) != 0) { purple_debug_error("core", "Error writing %s: %s\n", new_name, strerror(errno));