diff src/account.c @ 10399:aab0c9508318

[gaim-migrate @ 11630] Don't erase prefs/accounts/blist/pounces if we failed to write the new file to disk - this fixes the "Gaim lost all my settings when my disk/quota filled up" bugs. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Sun, 19 Dec 2004 17:35:59 +0000
parents b234ad7e0dfe
children 6a043ae92db6
line wrap: on
line diff
--- a/src/account.c	Sun Dec 19 12:57:29 2004 +0000
+++ b/src/account.c	Sun Dec 19 17:35:59 2004 +0000
@@ -1481,6 +1481,7 @@
 gaim_accounts_sync(void)
 {
 	FILE *fp;
+	struct stat st;
 	const char *user_dir = gaim_user_dir();
 	char *filename;
 	char *filename_real;
@@ -1527,6 +1528,13 @@
 		return;
 	}
 
+	if (stat(filename, &st) || (st.st_size == 0)) {
+		gaim_debug_error("accounts", "Failed to save accounts\n");
+		unlink(filename);
+		g_free(filename);
+		return;
+	}
+
 	filename_real = g_build_filename(user_dir, "accounts.xml", NULL);
 
 	if (rename(filename, filename_real) < 0) {