im.pidgin.pidgin: 1393fe1c1af12c0ab59459204a99b20c82c4e4e4

resiak at soc.pidgin.im resiak at soc.pidgin.im
Sun Nov 11 09:20:59 EST 2007


-----------------------------------------------------------------
Revision: 1393fe1c1af12c0ab59459204a99b20c82c4e4e4
Ancestor: 69180401d973d41aefe078f52d6b43f28a1f77bc
Author: resiak at soc.pidgin.im
Date: 2007-11-11T14:08:30
Branch: im.pidgin.pidgin

Modified files:
        libpurple/protocols/gg/gg.c

ChangeLog: 

Handle fwrite returning 0 in gg's "save my buddy list to a file" code,
squashing a warning.  (What's the point of this code given the various
export/import plugins?)

-------------- next part --------------
============================================================
--- libpurple/protocols/gg/gg.c	67cb239311bc65dd99f094c3ee0a5a60cb8fb074
+++ libpurple/protocols/gg/gg.c	50334db6c9e022e9ac601aa0ec7ac67f43302dc5
@@ -281,12 +281,22 @@ static void ggp_callback_buddylist_save_
 		return;
 	}
 
-	fwrite(buddylist, sizeof(char), g_utf8_strlen(buddylist, -1), fh);
-	fclose(fh);
-	g_free(buddylist);
+	if (!fwrite(buddylist, sizeof(char), g_utf8_strlen(buddylist, -1), fh)) {
+		const gchar *err = g_strerror(errno);
+		gchar *title = g_strdup_printf(
+			_("Couldn't write buddylist to %s"), err);
 
-	purple_notify_info(account, _("Save Buddylist..."),
+		purple_debug_error("gg", "Error writing %s: %s\n", file, err);
+		purple_notify_error(account, title, title, err);
+
+		g_free(title);
+	} else {
+		purple_notify_info(account, _("Save Buddylist..."),
 			 _("Buddylist saved successfully!"), NULL);
+	}
+
+	fclose(fh);
+	g_free(buddylist);
 }
 /* }}} */
 


More information about the Commits mailing list